#!/bin/ksh ################################################## # rename files in current directory that have caps # to lowercase # # To do subdirs, do a "find . -name > /tmp/myfile" # then run this script with an argument of /tmp/file. # i.e. rename_case /tmp/myfile # ################################################## if (( $# )) then #Reverse sort so you start at the lowest level and come # up, otherwise, you rename upper level dirs to lower case # and the subdirs no longer work. FILES=$(cat $1 | sort -r) else FILES=* fi for FILE in $FILES do if [[ -n $(echo $FILE | grep '[A-Z]') ]] then echo "Renaming: $FILE" mv $FILE $(echo $FILE | tr '[A-Z]' '[a-z]') else echo "OK - No Action: $FILE" fi done