updates @ m.blog

Renaming Files With RegEx

I finally found a good command-line solution for batch renaming files, and would always end up writing some damn overly complex tcsh foreach loop. This short perl script basically just wraps Perl pattern matching into a file renamer shell script, but its quick and handy for those familiar with that type of syntax.

[kaffe:~/screenshots] matthew% ls Explorer-001.png Explorer-003.png Explorer-005.png Explorer-002.png Explorer-004.png Explorer-006.png [kaffe:~/screenshots] matthew% regexrename 's/Explorer-00(.)/AnnotateDemo_1/' *.png [kaffe:~/screenshots] matthew% ls AnnotateDemo_1.png AnnotateDemo_3.png AnnotateDemo_5.png AnnotateDemo_2.png AnnotateDemo_4.png AnnotateDemo_6.png

(For those of you that are afraid of the command line, this GUI program for OSX seems to have no shortage of good reviews.)

Comments