Way back before Linux was even brought to life, sucky ol MS-DOS had an easy way to rename many files according to a simple scheme, which still works in today's DOS shells (a big hint for stuck Windows Explorer users):
C:\>ren *.txt *.htm
Semi-Desktop Environments like Norton Commander also had their
way with it, mark a bunch of files,
*.htm" and that's it. Yet, Unix and Linux users often look for
such a tool, and mostly end up writing their own, or do it by hand after all,
because case-sensitive filesystem need it more than ever.
According to the
mmv(1) manpage, Vladimir Lanin
mmv back in 1989 -- yet this nice utility
appeared first in the "late" Linux distros, IIRC it was SUSE Linux 7.x that had
it -- and that has been 1999 -- long after 1989.
The syntax is a bit different than the DOS one, but it's a little more flexible in that it allows multiple placeholders and even conversions. The above text to html would look like this:
mmv "*.txt" "#1.htm"
Conversions are necessary when e.g. files from a
case-insensitive filesystem (such as FAT, NTFS, ISO-9660) are copied. As of
Linux 2.4.??, the
iso9660 fs code seems to
displays filenames whose chars are all uppercase in lowercase. (Which is BTW
meaningful.) Yet, in cases where manual adjust is needed, mmv helps
mmv "*" "#l1"
Where the small L stands for lowercase. Note that this will
NOT work on case-insensitive filesystems, since a rename from e.g.
abcd" is considered the same filename. You
will need to use an intermediate temporary filename. The recursive_lower
script from HXtools will do
this. It operates on single files and/or directories, and if it is a dir,
descends into it.
Will this lower everything in
WINDOWS itself, but will not change
A small "U" can be used to uppercase certain characters. An
*) stands for zero or more characters, a question mark
?) for exactly one character. Thus, you could use this to
upper-ize the first character:
mmv "?*" "#u1#2"
That's the basics of mmv, hope it helped you.
mmv can do some more (excluding the
vfat workaround), which
is described in its manpage.