Batch renaming file extensions in Mac OS X

In the example below we will rename all files with the ‘.tmx.xml’ extension in the directory to ‘.tmx’

  1. Open a Terminal and change to the directory containing the files you want to rename.

  2. Type the following commands and press Enter:

for i in *.tmx.xml; do mv "$i" "`echo $i | sed 's/tmx.xml/tmx/g'`"; done


for i in *.current file extension; do mv "$i" "`echo $i | sed 's/current extension/new extension/g'`"; done

Replace the “current extension” and “new extension” values with the ones you want to rename from -> to.

As an alternative, you can use the [Homebrew] (http://brew.sh/) package manager and install the ‘rename’ package.

brew install rename

rename 's/current extension/new extension/' *.current file extension