This is about rename (mp3) files with the command line in Linux to a nice format.
Change the first character of each word tot uppercase
Suppose your filename is something like:
04 - cymballistic - blues for sarah.mp3
and you want to change that to:
04 - Cymballistic - Blues For Sarah.mp3
Use this command.
rename 's/[\(| ]\w/\U$&/g' *mp3 -nNOTE If you want to test your rename command use the -n option. The -n option give you a result on the screen (STD OUTPUT) without renaming the filename. If the result is what you expect then execute the command without the -n option.
rename 's/[\(| ]\w/\U$&/g' *mp3 -nChange the underscore to a space
Suppose your filename is something like:
04_-_cymballistic_-_blues_for_sarah.mp3
and you want to change that to:
04 - cymballistic - blues for sarah.mp3
Use this command.
rename 's/_/ /g' *mp3Rename filenames with find
You can also use the rename command in combination with find. This makes it possible to change some text in filenames recursively.
Suppose I am a big Temptation fan and I want to correct all my Temptations mp3 files to the correct name of the band "The Temptations" in stead of "Temptations". I can do this with this command on the command line.
First find will look in filenames using the option "-iname". it will only look in mp3 file and leave the jpg etc as the are.
The find gives the result to the option -exec to execute a command with the output of each line. Theer you see a normal rename command where the input is {}. {} Is the result from find's output.
find ./ -iname "*- Temptations*.mp3" -exec rename 's/(.*)- Temptations -(.*)/$1- The Temptations -$2/' {} -n \;