On Mac, I generally just use the batch rename feature built in to Finder.
But sometimes that feature isn't quite robust enough for the kind of renaming I want to do. And sometimes I need to do renaming on other platforms (Windows, Linux, etc.)
It's kind of hacky, but a good general solution that I've found is to make batch files in a text editor like Sublime Text that allows multiple selection and good regular expression search/replace.
You start with a listing of the directory contents:
...and end up with a shell script or batch file for renaming the files, which you then run...
Code: Select all
mv One.png blah_one.png
mv Two.png blah_two.png
mv Thee.png blah_thee.png
For me, the specific steps go something like this:
- Use the appropriate command ("dir" on windows, "ls" on other platforms) to get a list of files in the directory.
- Copy and paste it into Sublime Text
- Use column select to put a cursor instance at the beginning of every line in the file
- Ctrl+Shift+End or Cmd+Shift+RightArrow to select the filename, End, Space, Ctrl+V (or Cmd+V) to paste a second copy of the filename (at this point I have two copies of every filename on each line, separated by a space)
- Use batch editor or regexp search/replace to do whatever I need to do to the 2nd name on each line
- Use the home key and insert the appropriate rename command for each platform at the beginning of each line (again, with multiple cursor instances, this is a single step)
- Save with the appropriate shell script / batch file extension
- Run it
If the whole multiple cursor instances thing doesn't make sense, take a look at the
sublime text web site; the main page has an animation showing multiple cursors. Sublime Text isn't the only editor with that kind of feature; it's just the one I happen to use.