jostein.kjønigsen.net

RxRename - A Regular Expression based renaming tool

Background

If there's one thing I hate doing, it's breindead, repetitive tasks.

Like renaming 100 files from one specific naming convention to another. This is obviously something that can be automated.

When I encounter situations like this, I usually fire up a bash-shell and make a funky one-liner involving perl, regular expressions and whatever it takes to get the job done. But sometimes, like when filenames contain spaces, this literally turns into a mess pretty quickly.

So I decided that my windows box needed som decent commandline-tools as well and made this simple renaming tool. I could have made this a windows application, but for stuff like this the commandline just feels right.

The tool

Behold RxRename. Enter a directory and type RxRename (match) (replace) and that's it. For instance the following line will rename any files with a date formated as YYYY-MM-DD into a file with the date formated as (YYMMDD):

RxRename "20(\d\d)-(\d\d)-(\d\d)" "($1$2$3)"

Pretty simple, pretty useful.

The tool can be found here, and for those interested, the source-code can be found here.

Like anything else I make these days, it requires the .NET 2.0 framework.

Comments

Kristian

www.secure-my-email.com


You're aware of the existence of sed, right? whitespace isn't any problem. And of course CLI is the best, it virtually always is.

Jostein

jostein.kjonigsen.net


sed & perl simply didn't co-operate today. Let's put it that way. And it was the whitespaces making things bitchy today.

And right after I made this, someone informed me about "rename", which basicly does the same thing as my tool. Oh well.

Thanks to

Various reasons

Misc stuff