Friday, April 3, 2015

Rename File Extensions in Bash

A while ago I have posted an article on how to Rename File Extensions with OS X Automator. Since then I have been using Bash scripting a lot more and since running a one liner is sometimes a lot faster than messing about with apps I have produced this little gem...

$ for old in ./*.m4a; do new=$(echo $old | sed -e 's/m4a$/m4b/'); mv -v "$old" "$new"; done

It renames m4a files to m4b, that's all :)