> 
> >>>>> "sl" == Simon Liddington <[EMAIL PROTECTED]> writes:
> 
>   sl> Can anyone think of an easy way of changing the case of the
>   sl> names of a directory tree of files?
> 
> This comes up a lot as a question.  The answer involves using "tr".  A
> full answer appears in the comp.unix.shell (or maybe comp.unix.misc)
> FAQ, so I probably shouldn't reproduce it here.   It's reasonably
> short.
> 
> 
---------------------try this----------------
:
# @(#) tolower v1.0
#

if [ ! "$*" ]
then
   echo "Preparing to rename ALL files. OK to continue? (y/n) \c"
   read OK
   case $OK in
      [yY])
         LIST=`ls`
         break
         ;;
      *)
         echo "Usage : `basename $0` file [ file ... ]"
         exit 1
         ;;
   esac
else
   LIST=$*
fi

for NAME in $LIST
do
   NEW_NAME=`echo $NAME | tr "[A-Z]" "[a-z]"`
   if [ "$NAME" != "$NEW_NAME" ]
   then
      echo "Renaming $NAME to $NEW_NAME"
      mv ./$NAME ./$NEW_NAME
   fi
done


-- 
  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.

Reply via email to