rename multiple files
You have a folder full of files that need to be renamed in some way. In this example, we have files from iMovie named Clip 01.mp4, Clip 02.mp4 etc… but we want them to be named 012_01.mp4, 012_02.mp4, etc… Use a bash loop with sed:
ls -1L *.mp4 | while read file;do mv "${file}" `echo "${file}"|sed 's/Clip /012_/'`; done
- note - this does work with filenames having spaces, but see the bash_loop page for more details