Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change the files to small letters?

Status
Not open for further replies.

bonsky

MIS
Apr 23, 2001
280
US
does any body knows how to change all the files in a certain directory, from CAPS to small letters?? script will do..

thanks!
 
Code:
#!/bin/ksh

__RENAME() {
        NewFileName=$(cat /tmp/x$filename)
        print $NewFileName
        mv /tmp/temp/$filename /tmp/temp/$NewFileName
        return
}

set -A file $(ls /tmp/temp)
dir=/tmp/temp
filenum=${#file[@]}
p=0
while (( p < filenum ))
do
        c=0
        filename=${file[$p]}
        filenamelen=${#filename}
                while (( c < filenamelen ))
                do
                        typeset -l t=${filename:$c:1}
                        print -n $t >> /tmp/x$filename
                ((c+=1))
                done
__RENAME
((p+=1))
done
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top