Time to put the spotlight on a utility which I have had good use for twice within the last five days: mmv.

I am unsure about the mnemonic, but it wouldn’t be a far stretch of the imagination to think it stands for multiple move, since that is what it does. It is not a part of the basic installation of Ubuntu (well as far as I know, I have been too lazy to upgrade since Feisty) so you need to install it first (sudo apt-get install mmv).

mmv does renaming based on pattern-matching, but I don’t think (I haven’t really explored it, I found what I needed and didn’t explore much further) it supports PCRE, so it does mean learning yet another regular expression syntax. It isĀ  however rather easy, at least it was for my needs.

Given a directory with a bunch of jpeg images, with numerically sequenced names and (yuck!) uppercase extension (.JPG) I simply wanted to rename them all with the same names, but lowercase extension (.jpg)

$ mmv "Pic_*.JPG" "Pic_#1.jpg"

Rather simple, the asterisk (wildcard) maps to the back-reference #1, my guess is that it supports several wildcards, but that is unverified.

That was Thursday. Today I downloaded a bunch of videos from FSCONS, and decided that the ending -ol in the name, (e.g. TheFutureOfCopiright-ol.ogg) was rather unnecessary, so again I sent mmv into action with

$ mmv "*-ol.ogg" "#1.ogg"

And there you have it.

Tags: , ,

Comments are closed.