lowercase the filenames

August 4th, 2008 | by guda |
#!/bin/sh
# lowerit
# convert all file names in the current directory to lower case
# only operates on plain files--does not change the name of directories
# will ask for verification before overwriting an existing file
# http://www.linuxjournal.com/content/convert-filenames-lowercase 
for x in `ls`
do
  if [ ! -f $x ]; then
    continue
  fi
  lc=`echo $x  | tr '[A-Z]' '[a-z]'`
  if [ $lc != $x ]; then
    mv -i $x $lc
  fi
done

Post a Comment

Trackback URL for this post:
http://www.gudasoft.com/uncategorized/08/04/93/lowercase-the-filenames/2008/trackback