[geeks] Re: [SunRescue] filenames..

Wolfgang Engelien geeks at sunhelp.org
Thu May 24 12:02:02 CDT 2001


>Nope, that will try to change anything find finds to lowercase.  Well, it
>will if you insert a ']' character after the "[a-z".  :-)

Well, when I have the file testfile in TESTDIRECTORY
./TESTDIRECTORY/testfile
find will give out 
./TESTDIRECTORY/testfile
and the mv command will try a
mv ./TESTDIRECTORY/testfile ./testdirectory/testfile
but can't since ./testdirectory in not existent.

The original task was anyway to change the uppercase
FILENAMES into lowercase filenames - the changing of
directory names was not mentioned - is maybe not even
desired.

Based on the previous suggestions a solution would be
to create a script UP2low which contains

### UP2low - BEGIN ###
cd $1
for uppercase in `ls -p * .* | grep -v "/"`
do
  for lowercase in `ls $uppercase|tr [A-Z] [a-z]`
  do
     mv $lowercase $uppercase 2>/dev/null
  done
done
### UP2low - END ###

and call this script by
find . -type d -exec UP2low {} \;

I didn't try it, but this should work.
Wolfgang
#####
# Wolfgang Engelien                       
# Tel.: +1 (212) 746 3724
# Fax.: +1 (212) 746 5818
# email: wolfgang at hanazono.med.cornell.edu
#####



More information about the geeks mailing list