echo
echo "Sunbelt UNIX low_case Command Script   Version 10.2 01 Oct 2019"
echo "(C) Copyright 1987-2019   Sunbelt Computer Systems, Inc.   N999999\\n"
 
if [ "$1" = "-?" -o "$#" = "0" ]
then
echo "low_case - Sunbelt script to convert directory entries from upper"
echo "           case to lower case.  Supports use of wildcards."
echo
echo "Examples:"
echo "    low_case *.dbs (Convert any directory entry with .dbs ext.)"
echo "    low_case *.*   (Convert all directory entries with an ext.)"
echo "    low_case *     (Convert all directory entries)"
echo
    if [ $# = 0 ]
    then
        echo "COMMAND LINE ERROR!  A file name or valid UNIX wildcard required."
     fi
exit 1
fi
 
for i in `ls $*`
do
  j=`echo $i | tr '[A-Z]' '[a-z]'`
  if [ ${i} != ${j} ]
  then
      mv $i $j
      if [ $? = "0" ]
      then
          echo "'"$i"' converted to '"$j"'".
      else
          echo "Unable to convert '"$i"' to '"$j"'".
      fi
  fi
done
