#!/bin/bash

# Translate all upper case file names to lower case filenames.
# program takes a file list as an argument.
# Program is recursive.

for file in $*
do
   # 
   # Convert file name to lower case 
   #
   lower_case_file=`echo $file |tr '[A-Z]' '[a-z]'`
   if [ "$lower_case_file" != "$file" ]
   then
      mv $file $lower_case_file
   fi
   #
   # If it is a directory, cd into it and rerun this program
   #
   if [ -d "$lower_case_file" ]
   then 
     cd  ./$lower_case_file
     $0 `ls`
     cd .. 
   fi
  
done   
