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

To make the above script more usable, for create a little script in ~/bin named rename, in the script, use the following:

#!/usr/bin/env zsh
SUBSEXPR=$1
shift
for i in $@; do mv $i `echo "$i" | sed $SUBSEXPR`; done

Then in the future, rename files with the following usage:

rename 's/old/new/' *.files

Inspired from: http://superuser.com/questions/152627/renaming-many-files-in-mac-os-x-batch-processing

Advertisements