Sunday, March 14, 2010

Capitalizing MP3s from the command line

For my own future reference and your enjoyment, here's a neat little oneliner to transform 01 - some song.mp3 into 01 - Some Song.mp3:

rename "s/([^._'])\b(\w)(\w*)/\$1\U\$2\L\$3/g" *.mp3

It needs the prename utility from Perl, which on Ubuntu is available by default under the name rename.


Marten said...

I use the script at as a macos service. It's basically a regex, and it handles edgecases like can't correctly.

binarycodes said...

just use

prename 'y/A-Z/a-z/' *

Thomas ten Cate said...

If I'm not mistaken, that command will downcase everything. Not quite what I intended.