Geeks With Blogs

News This is the *old* blog. The new one is at blog.sixeyed.com
Elton Stoneman
This is the *old* blog. The new one is at blog.sixeyed.com

Smart Rename is a little tool I put together a while back and have found pretty useful – it's up on CodePlex here: Smart Rename.

It lets you rename files in bulk, based on a pattern you provide:

It should be fairly self-explanatory, but in case not: anything in the pattern flagged with %...% will be evaluated for each file in the list and replaced with a computed value. Arguments can be passed to the computing component with the syntax %replacement%{arg1:arg2}. You can preview the new name before making any changes, and when you commit it will report whether it was successful at renaming each file.

One frequent use is for changes to project names halfway through development. So when Project Tango becomes Project Sierra, you can use %string%{Acme.Tango:Acme.Sierra} to rename C# projects with names like Acme.Tango.Entities.csproj. Or if you want to prefix filenames with the folder they're in and suffix them with the current date, you can do it with %folder%_%filename%_%date%. Some of the replacements available look odd, but I've had a use for them all at some time. By default SmartRename retains the original file extension, but you can override that to change extensions too.

Technically there isn't much to it. Replacements are evaluated through classes which implement IReplacement and are configured using Castle. Currently the following are provided:

Adding new replacement functionality is very simple, just a case of implementing the IReplacement interface (or extending from ReplacementBase) and adding the class as a component in the app config.

Posted on Thursday, June 19, 2008 10:30 PM CodePlex Project | Back to top


Comments on this post: Smart Rename tool on CodePlex

# re: Smart Rename tool on CodePlex
Requesting Gravatar...
Powerfully awesome tool! It just saved me hours in testing a bulk process. Your tool completely made my day! Thank You so much for making this available.
Left by Matthew on Jul 29, 2009 11:08 AM

# re: Smart Rename tool on CodePlex
Requesting Gravatar...
Glad to hear it was helpful for you Matthew, thanks very much for your comment.
Left by Elton on Jul 29, 2009 1:38 PM

# re: Smart Rename tool on CodePlex
Requesting Gravatar...
How do I escape spaces in string replacements?
right now, have a space in either of the strings (i.e. %string%{nospace:with space} causes weird results.
Left by mike on Apr 08, 2011 9:04 AM

# # re: Smart Rename tool on CodePlex
Requesting Gravatar...
Smart Rename is a little tool I put together a while back and have found pretty useful – it's up on CodePlex here
Left by Mulberry Outlet on Oct 14, 2011 3:41 AM

# re: Smart Rename tool on CodePlex
Requesting Gravatar...
What is the purpose of having this smart rename tool on codeplex? group training
Left by group training on Nov 02, 2011 11:29 PM

# re: Smart Rename tool on CodePlex
Requesting Gravatar...
Overall the jacket was quite nice. I will keep it but with reservations. Mainly, the outer zipper is flimsy.
Left by columbia jackets on Nov 09, 2011 8:38 AM

# re: Smart Rename tool on CodePlex
Requesting Gravatar...
North Face Jackets, both North Face Jackets For Women and North Face Jackets For men, are playing an important role in our fall, winter and spring life. They can be your daily necessities. They can also be a great gift to your families or friends to show your love. An awesome North Face Jackets as a birthday, Thanks Given Day, Christmas Day or Valentine's Day gift would surely make the receiver full of gratitude and love towards you.
Left by North Face Jackets For Women on Nov 19, 2011 7:50 AM

# re: Smart Rename tool on CodePlex
Requesting Gravatar...
When you come into North Face shop, you will find that cheap north face jackets is the most popular items of the North Face products, comparing to other items of North Face outdoor products.
Left by North Face Fleece Clearance on Jan 12, 2012 8:55 AM

# re: Smart Rename tool on CodePlex
Requesting Gravatar...
These snapback caps are a great way to make someone very happy. There are even women who like to wear tisa snapbacks caps. They are very trendy right now. The fact is that fashion is returning and that everything just is starting to look as it did some years ago.
Left by Cheap Tisa Snapbacks on Feb 17, 2012 7:30 AM

Your comment:
 (will show your gravatar)


Copyright © Elton Stoneman | Powered by: GeeksWithBlogs.net