Batch Rename or Move An Extension In Linux (Eg .JPG to .jpg)

A short and easy trick, but one that is either not referred to or more complex examples given. I wanted to change a bunch of upper case .JPG images to lower case. Rather than writing a bash script or some such, I just used the ‘rename’ command:

rename 's/\.JPG$/\.jpg/' *.JPG

It may depend on perl being installed though. I don’t have a Linux machine to hand that doesn’t have perl present, so I cannot verify this. If this command doens’t work for you, please leave a comment to that effect below.

Another useful one from the manpage:

rename 'y/A-Z/a-z/' *

To translate upper case filenames (and extensions by the looks of it) to lower case.

Tell us what's on your mind