#!/bin/sh

# will convert specified files to lowercase names

if [ "$1" = "-r" ] ; then
	recurse=1; shift;
else
	recurse=0;
fi;

for x in $* ; do
	if [ -r "$x" ] ; then
		conv="`echo $x | tr '[a-z]' '[A-Z]'`";
		if [ "$x" != "$conv" ] ; then
			mv $x ${x}.tmpcase;
			mv ${x}.tmpcase $conv;
		fi;
		if [ $recurse -gt 0 -a -d "$conv" ] ; then
			$0 -r $conv/*;
		fi;
	fi;
done;
