[geeks] Re: [SunRescue] filenames..

Nick Kociuk geeks at sunhelp.org
Wed Jul 4 17:10:41 CDT 2001


replying over a month after the original message, as i catch up on several
thousand list messages...

> Or (nicked from the UGU daily tips)...
>
> This script can be used to
> renames all the file in
> current directory with
> UPPERCASE letters to lowercase.
>
> I uses it because some time when
> I try to upload some files from
> a Windows system to a unix based
> web server, the files somehow gets
> converted to UPPERCASES, which is
> undesirable.
>
> ###########################
>
> for uppercase in `ls`
> do
>   for lowercase in `ls $uppercase|tr [A-Z] [a-z]`
>   do
>      mv $lowercase $uppercase 2>/dev/null
>   done
> done
>
> ############################
>
>
> This tip generously supported by: ssdhawan at bhartitelesoft.com

i came up the following script when i was first learning unix, which does
the same thing (convert all the entries in the current directory to
lowercase).  it took me forever to figure out, but i became quite familiar
with the system during the process..

## lowerdir
ls > tmp1
tr A-Z a-z < tmp1 > tmp2
paste tmp1 tmp2 > tmp3
ed tmp3 <<!
g/^/s//mv -i /
w
q
!
sh -x tmp3
rm -f tmp1 tmp2 tmp3
##




More information about the geeks mailing list