Posts Tagged ‘perl’

batch rename with regexps, an addendum

Friday, November 20th, 2009

You may have read my post on batch rename with perl’s ‘rename’ script, but I recently discovered that it is helpful to read the man page.

I had a folder full of files that I wanted to rename, but I wanted to test things out first. I had settled for making a temporary directory and just symlinking to the files that I wanted to modify. I would run my tests, look at the link names, then delete and recreate the links.

Well, that is no more. `rename` has an option -n, for “No Act”, that will not actually rename the files. Instead, it will just print the filenames that matched and what they would have been renamed to.

Perfect!

Anyway, as the old saying goes, RTFM!
-LightningCrash