Batch change file extensions in Mac OS X?

5,658

Solution 1

Use Name Mangler to do this. Shareware, but: Trial version: Name Mangler will work for 25 launches without limitation.

You can see the original and future file names on the left, and the configuration of Number Sequentially I used on the right. Important here is to manually define .jpg suffix, and not appending the original extension.

Screenshot of suitable configuration


The free NameChanger also can do this. (thanks slhck!)

Screenshot of suitable configuration

Solution 2

I'm assuming you want 1.jpg.1 to be renamed to 1-1.jpg, or you'll lose them. Quick and dirty comes to mind: just use sed to construct a shell script on the fly and have sh run it:

$ ls -1 *jpg* | sed -e 's@\(.*\)\(\.jpg\.\)\(.*\)@mv \1\2\3 \1-\3.jpg@' | grep ^mv | sh 

Strongly suggest you check the output just before the sh to make sure it's actually going to do the right thing.

Share:
5,658

Related videos on Youtube

Thalecress
Author by

Thalecress

Updated on September 18, 2022

Comments

  • Thalecress
    Thalecress almost 2 years

    I used wget to download a website into a folder. When files have the same names, wget stores the new one as name.extension.#

    Now I have hundreds of files like 1.jpg, 1.jpg.1, 1.jpg.2, etc.

    How can I change every file with a .jpg* extension into plain .jpg?

    EDIT: I used freeware NameChanger, which let me organize by EXIF data before changing the extension.

  • Thalecress
    Thalecress about 12 years
    I'm pretty sure that I'll lose
  • brevno
    brevno about 12 years
    This doesn't work with filenames that have spaces or some other special characters.