Today I had a directory of images whose file name extensions are
.jpeg. I need them as
.jpg but I didn’t want to rename them one by one.
Here’s how we can change the file extensions in a directory by batch. And by the way, I am on Mac OS El Capitan version 10.11.5 with Homebrew package manager.
First, open your Mac’s Terminal.
Type the command
rename just to check if you have it installed in your system. If the Terminal displays usage instructions on
rename then you already have it.
rename is a command not found, then install it via Homebrew using this command:
brew install rename
rename command is available, navigate to the directory where your files that need new extensions are.
Then edit the following command to suit your needs before running:
rename "s/jpeg/jpg/" *.jpeg
The syntax for this is actually
rename "s/OLD_EXTENSION/NEW_EXTENSION/" *.OLD_EXTENSION
That’s all! I hope that worked for you.
Resource: Changing extension to multiple files