[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ale] quick way to rename all files ?



> 
> Is there a quick way to rename all files in a directory to lower case?
> Same filename, just rip through and make sure they are all lowercase.
 
This should work for bash:
------------------------------------
for i in * ; do
   lc=$(echo $i|tr [A-Z] [a-z])
   if [ $lc != $i ] ; then
      if [ -f "$lc" ] ; then
         echo "$lc already exists"
      else
         mv $i $lc
      fi
   fi
done
-----------------------------------

Just tested it. Seems to work.  Hope it helps,

BAJ
--
To unsubscribe: mail majordomo at ale.org with "unsubscribe ale" in message body.