mmv — Rename multiple files
MMV is a command-line tool which allows the user to move, rename, copy, append and link large amounts of files with a single command. The tool is especially useful when you need to rename a lot of files that have similar filenames, yet subtle differences.
It matches the files using the wild-card(‘FROM’ pattern) you gave to indicate the source file(s). Then it will rename the matched files according to the second argument (‘TO’ pattern) to indicate the destination file(s). The ‘From’ pattern can take all the usual shell wild-cards such as ‘*’, ‘?’ and ‘‘. Remember that you need to enclose the patterns with quotes, otherwise they will be expanded by the shell and mmv won’t understand them!
The ‘#1′ in the ‘TO’ pattern is a wild-card index. It matches the 1st wild-card found in the ‘FROM’ pattern. A ‘#2′ in the ‘TO’ pattern would match the 2nd wild-card, etc. MMV replaces any occurrences of wild-card indexes with the text for the corresponding wild-card in the ‘FROM’ pattern. Note that ‘??’ are actually two wild-cards, both of which match a single character!
$ mmv "*.tar.gz" "#1.tgz" -- Rename all the file extension from.tar.gz to .tgz $ mmv "file*.txt" "file_#2.txt" -- Insert a underscore in filename. $ mmv "*.txt" "#l1.txt" -- Convert the filenames to lower case. $ mmv "*.txt" "#u1.txt" -- Convert the filenames to upper case. $ mmv -r "*" "#u1" -- Convert dir and file names to upper case.