in reply to How to rename to lowercase every file in a directory and its subdirectories?

Simple, Safe, Fast, One-Line Solution
=============================================
To combine all the ideas into a safe, but fast, solution that won't overwrite existing files without warning, use:

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.

  • Comment on Re: How to rename to lowercase every file in a directory and its subdirectories?
  • Download Code