Mass renaming should be a lot easier than I make it, and there is probably still an easier way than what I've found. However, recently when I was trying to rename a portion of my music collection I stumbled upon the program mmv. The next time I wanted to use it, I had to look up the man page again, so here is a small tutorial on mmv for myself.

MMV for mp3 File Renaming

I was going through my iAudio X5 renaming some of my older songs to fit with my file hierarchy. For example, I had Artist/Album/Artist - Song.mp3. Having both the folder and file labelled with the artist is needlessly redundant, and makes it hard to find the song I want on the small display of my mp3 player. All I wanted was to remove the "Artist - " from the beginning of each song.

So to perform this similar rename to all files in a folder, use the mass mover, mmv. This uses similar syntax as mv, with mmv "from" "to". It also makes extensive use of wildcards, specifically * (any string), ? (any character), [...] (specific characters), and ; (searches for */ any number of times, so you can look for something in a lower folder). I use * extensively, and look at the man page for help with the others.

In the "to" field, the wildcards are used in order, referenced by #1, #2, ect. So mmv "." "#2.#1" would reverse the extension and the name of a file (eg. readme.txt > txt.readme).

From the above comment, the syntax requiring quotes should be obvious. Around each filename quotes are needed or else mmv complains.

Summary

Skip to the end, to rename all the "Artist - Song.mp3" songs, the command needed is mmv "Artist - *" "#1". If you ever want to add back the artist, the reverse is mmv "*" "Artist - *"

Previous Post Next Post