Mac and Linux Tip: Bulk Rename File Extensions With Terminal and/or Shell

How To: Bulk Rename File Extensions With Terminal/Shell

Lets say you have a bunch of .jpg files that you know are actually .rar files.

What would be the simplest way to rename them all?

First you’d navigate to the directory that contains the .jpg files with the “cd” command

For brevity lets assume the only .jpg files in this directory are .jpg files that you want to change

All you have to do is run this command

mv *.jpg *.rar

And all the .jpg files will have been renamed to .rar

If you want to learn more about the “mv” command just type in

man mv

Advertisements

One thought on “Mac and Linux Tip: Bulk Rename File Extensions With Terminal and/or Shell

  1. Does not work:
    $ mv *.JPG *.jpg
    mv: target `*.jpg’ is not a directory

    $ ls -1
    P1010869.JPG
    P1010871.JPG
    P1010872.JPG
    P1010877.JPG
    P1010878.JPG
    P1010882.JPG
    P1010888.JPG
    P1010889.JPG
    P1010891.JPG

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s