On Mon, Jan 12, 2004 at 09:38:27PM -0700, Charlie wrote:
> I have a bunch of folders(several hundred) that I copied over from my Win2k 
> partition that I want to rename. Windows names them using a capital letter 
> and I want to rename them all to all lower case.
> 
> Example: rename Documents to documents
> 
> Is there an easy way to do this? I don't want to do all these one at a time.

man tr

so,

#!/bin/bash
find . -type d -mindepth 1 > folderlist
while read line
do
        newName=`echo "$line"|tr [A-Z] [a-z]`
        echo $newName
        #mv "$line" "$newName"
done<folderlist
rm -f folderlist

[EMAIL PROTECTED] test]$ l -1
My Documents/
t.sh*
Windows Sucks/

[EMAIL PROTECTED] test]$ ./t.sh 
./my documents
./windows sucks

[EMAIL PROTECTED] test]$ l -1
my documents/
t.sh*
windows sucks/

Uncomment the mv line to actually rename folders if you're sure it won't
mess anything up.

Todd

Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to