in reply to How to rename to lowercase every file in a directory and its subdirectories?
find . -type f | perl -ne 'chomp; $src=$_; $lc = lc $src; if ($src ne $lc) { if (-e $lc) { print STDERR "Cannot lc $src (file $lc exists)\n"; } else { rename($src, $lc) || warn "$src: $!\n"; }}'
Notice the absence of "-exec" option for find. Using "-exec" causes one process for every file found (very slow).
This code snippet was quite useful at http://www.CleanFunny.com/, where many images originally used random naming conventions.
Cheers,
Vess Consulting
www.vess.com
Originally posted as a Categorized Answer.
|
---|