Mac OS: How to batch edit file extension via Terminal

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.

If rename is a command not found, then install it via Homebrew using this command:

Once the 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:

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

Related Posts:

Posts that may be related to "Mac OS: How to batch edit file extension via Terminal":

Catzie

A Filipino programmer with a variety of interests such as baking, singing, making up silly song/rap lyrics, K-pop, drawing, creating unique dessert flavors, obsessing about finding out how some things works, board games, anime, video games, and forgetting things that usually go in her long list of interests. Running small-time online dessert shops Cookies PH and Catzie's Cakery.

Leave a Reply

Your email address will not be published. Required fields are marked *