This macOS Terminal utility is based off the Perl script of the same name. Refer to Perl documentation if you get stuck.
This cheatsheet is a work-in-progress. I’m still new to rename, so some things might be off.
You can install rename with Homebrew:
brew install rename
Batch rename files
--counter-format Here’s how to set to zero-padded to three digits:
rename --counter-format 001 *.jpg
rename --counter-format 000001 --lower-case --keep-extension --expr='$_ = "$N" if @EXT' *
Problematic as it reads
--just-print) will just show the changes in Terminal without applying them to the actual files.
rename -n # rest of command to preview
I use it almost every time I use rename; first running the desired command with
-n (and usually fixing one or two things) and then, when I’m happy, running the real thing without