Bulk rename files in CLI

December 19th, 2009

Warning: This post is 12 years old. Some of this information may be out of date.

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