perlmv: Renaming files with Perl code
perlmv is a script which I have personally been using all the time for years, but has only been uploaded to CPAN today. The concept is very simple, to rename files by manipulating $_ in specified Perl code. For example, to rename all .avi files to lowercase,
$ perlmv -de '$_=lc' *.avi
The -d option is for dry-run, so that we can test our code before actually renaming the files. If you are sure that the code is correct, remove the -d (or replace it with -v, for verbose).
perlmv can also save your code into scriptlets (files in ~/.perlmv/scriptlets/), so if you do:
$ perlmv -e 's/\.(jpe?g|jpe)$/.jpg/i' -W normalize-jpeg
You can later do this:
$ perlmv -v normalize-jpeg *.JPG *.jpeg
In fact, perlmv comes with several scriptlets you can use (more useful scriptlets will be added in the future):
$ perlmv -L
Let me know if you have tried out the script.