Chi,
depending on what you want to do
tr A-Z a-z
will get you a lowercase name. For example, here is a shell script that
will take all the files in the current directory and rename them to lower
case - it takes an argument -m, which if it isn't supplied the script just
prints out what it would do. If you name this namestolower, and make it
executable, then
namestolower -m
will find all the files in the current directory that begin with a
upper case letter and have a dot '.' in them, like FOO.TXT, or even Foo.txt
and rename them to foo.txt.
#!/bin/sh
MV=0
if [ "$1" = "-m" ] ; then
MV=1
fi
if [ "$MV" = 1 ] ; then
: echo "Doing the following changes"
else
echo "Showing what moves will take place, use -m to cause changes"
fi
for i in `ls [A-Z]*.* `
do
j=`echo $i | tr A-Z a-z`
if [ -f $j ] ; then
echo "File already exists $j, will not move $i to $j"
else
echo Renaming $i to $j
if [ "$MV" = 1 ] ; then
mv $i $j
fi
fi
done
-------------
steve
>I just migrate my web file form Windows NT to Linux, in NT,the file name
>is uppercase, now I need lowercase file name. How to do this. I know the
>"tr" command can to this, but I don't familiar with linux command. and
>body can help me ? Thanks a lot.
--
PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
http://www.redhat.com/RedHat-FAQ /RedHat-Errata /RedHat-Tips /mailing-lists
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject.