Click to See Complete Forum and Search --> : Changing caps


Damn The Nation
06-23-2001, 12:51 AM
hey, how do I change a lot of files in one folder from all caps to no caps.
eg:
FrEaKin.DOC to freakin.doc
and
FREAKIN.DOC to freakin.doc

thanks a lot

P.S I'm a newbie, so talk slowly.

Malakin
06-23-2001, 05:51 AM
make a file with your favorite text editor called upper2lower with the following contents:

#!/bin/sh
#

ls * | while read file
do
newname=$(echo $file | tr A-Z a-z)
if [ "$file" != "$newname" ]; then
mv $file $newname
fi
done


Put this file in your "/usr/bin" directory. Then use this command on the file "chmod +x /usr/bin/upper2lower". I say to put it in your /usr/bin directory just because your path will point there and the chmod command makes the file executable.

Then whatever directory you're in just type upper2lower and all the files in that directory will become lower case.