In ZSH:
% autoload zmv
% zmv '(**/)(*).(*)' '$1$2.${(L)3}'
Affects all files in the current directory and all subdirectories. For example, it turns Serenity.Ogg into Serenity.ogg, no matter where it is under the current directory.
First parenthetical matches current directory and all subdirectories, second group matches filename sans extension, third group matches extension. ${(L)3} transforms the extension to lowercase.
If you only care about a particular extension, you can simplify1 it to this:
% zmv -W '(#i)**/*.mp3' '**/*.mp3'
The (#i) matches case-insensitively (.Mp3, .MP3, and so on). The -W flag lets you use regular * and ** wildcards in both the source and target patterns, and automagically turns them into groups and backreferences like the first example.
If you only care about a particular extension in the current directory (not subdirectories), it’s even easier:
% zmv -W '(#i)*.mp3' '*.mp3'
That’s all I know.
Further reading:
- For some definition of “simple” that includes enough line noise to choke a German Shepherd. ↺


The POSIX sh(1) version looks like (assuming GNU find and xargs)
find . -type f -iname '*.mp3' -print0 |xargs -0n100 -P5 sh -c 'for f in "$@"; do mv "$f" "${f%???}mp3"; done' sh
As a bonus it runs five threads in parallel for you.
Comment by Andrew Neitsch — Thursday, June 7, 2007 @ 7:13 am
What about filenames that look like this /a/b/c.d.e or /a/b.c/d.e
Comment by Shakeel Mahate — Thursday, June 7, 2007 @ 7:59 am
There is also rename.
To translate uppercase names to lower, you’d use
rename ‘y/A-Z/a-z/’ *
If subdirectories are needed, use find with xargs:
find ./ -type f -iname * -print0 | xargs rename ‘y/A-Z/a-z/’
There is also:
mrename
krename
kfilerename
I recommend krename as it allows you to see your edits in “real time” before being applied. It has plugins that allow it to function based on permissions, date and time, do encoding conversions and transliteration.
Comment by Anonymous — Thursday, June 7, 2007 @ 9:44 am
Remember kids, always use the -n flag first.
Comment by Anonymous — Thursday, June 7, 2007 @ 10:39 am
There’s also the (somewhat easier to grasp for some) mmv with its counterparts (mcp, mad and mln).
Comment by Shot — Friday, June 8, 2007 @ 7:00 pm