uppercase to lowercase

Greetings & Happy New Years To All!

A client of mine FTP'ed their files up to the server and it all ended up being in UPPERCASE when it all should be in lowercase. Is there a builtin command or a script anyone knows of that will automagically convert all files to lowercase?

Please advise asap if you know how...

Thanks!

do you want to convert the file names or the contents of the file??

Thanks for your reply...

I just want to convert the files names, the directories and all files in the subdirectories to lowercase. File names and directory names only. Not the contents of the files.

I can do the direcotries by hand if necessary as there are only 5 or so but all the darn file names somehow got converted to UPPERCASE by my client....

Thanks again!

Try something like this:

#!/bin/sh
# Do the directories first, so that the
# path doesn't change
for each in `find . -type d`
do
newname=`echo $each | tr [A-Z] [a-z]`
mv $each $newname
done
# Now to the files...
for eachf in `find . -type f`
do
newnamef=`echo $eachf | tr [A-Z] [a-z]`
mv $eachf $newnamef
done

I tested this on my machine real quick, and it worked OK...

Hope this helps.

(By The Way, you'll get some errors from mv if the filename is already lowercase {I even got an error trying to move "." to "."} - you don't have to worry about those...)

Thanks it worked!

It justed needed a 'done' statment at the end and it worked perfectly!

Thanks a million!