need script

Kurt Granroth plug-discuss@lists.PLUG.phoenix.az.us
Tue, 24 Apr 2001 23:37:48 -0700


meg@cs.csoft.net wrote:
> Certainly someone must have a script (preferably Perl)
> laying around somewhere that will:
> 
> Recurse thru directories and rename files by replacing
> any UPPER case characters with lower and replacing spaces
> in the file names with something like underscores.
 
Off the top of my head, this might work:

 #!/bin/sh
 FILES=`find -type f`;
 for FILE in $FILES;
 do
   LOWER=`echo $FILE | tr 'A-Z ' a-z_`;
   mv $FILE $LOWER;
 done

Not tested and won't work if your directories have upper case letters
or spaces.
-- 
Kurt Granroth            | http://www.granroth.org
KDE Developer/Evangelist | SuSE Labs Open Source Developer
granroth@kde.org         | granroth@suse.com
            KDE -- Conquer Your Desktop