need script

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Kurt Granroth
Date:  
Subject: need script
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
         | 
            KDE -- Conquer Your Desktop