10/01/2009

Renaming multiple files with Flexible Renamer using Regular Expressions: removing numbers from filenames

Flexible Renamer is a free tool to rename multiple files written by a Japanese developer Naru. It is very straightforward to rename multiple files with it; my task was to remove the numbers from filenames, which were automatically appended by Outlook when I copied some messages from an Exchange Server, so that my subject is untouched. At the moment the author's download site is down, still the tool can be downloaded from CNET.

First you have to go to the folder where your files are. This you can do at the leftmost part of the application (see screenshot below).

To identify the filenames with numbers, we can use Regular Expressions, so choose RegEx from Rename Method. Since we want a complete match, click on the small triangle and select Only completely matched. The regular expression to match numbers in filenames is (.*)\(\d*\).msg : which can be broken down like this:
  • (.*) Take any characters any number of times (. and *), and group them in group 1 (so the matched content will be accessible by \1 in the Replace texbox)
  • \( Look for an opening bracket (the backslash before is there for escaping: so that the interpreter won't think it is a grouping we are about to do)
  • \d* Look for digits, any number of them (\d: digit, *: any)
  • \) Look for a closing bracket
  • .msg Look for the exact text .msg at the end of the filename.

Then just click Rename and voila: the files are renamed to the contents of the New Name column!

No comments:

Post a Comment