Rename files in bash


Posted by Andrew McCombe on Sat Dec 19, 2009

If you ever need to rename a batch of files using a regex or similar you can use the `rename` command:

# Rename .wav to .mp3
rename -v 's/\.wav/\.mp3/g' *

# replace all hyphens in jpgs with a space
rename -v 's/-/ /g' *.jpg