Lazy Mans Guide to Batch Renaming Files

Posted (Updated ) in Linux

In this second post of my lazy man’s series, I’ll explain an easy way to batch rename files in any linux distribution with the rename command. For users of the sed tool, this will look very familiar. You’ll also need a bit of knowledge of regular expressions:

rename 's/_/ /g' *.mp3

The above example replaces every underscore with a space character in all mp3’s of the current directory. The command works as follows:

rename 's/<search_term>/<replacement_text>/g' <regex_filename_match>

Thanks to jazzmusik of the Ubuntu Forums for his little tutorial found here.