#!/bin/bash

# Script to convert all filenames in specified directory to lowercase.
#
# Written by:  Chris Studholme
# Last Update: 8-Jan-1999
# Copyright:   GPL (http://www.fsf.org/copyleft/gpl.html)

if [ "$1" = "" -o ! -d "$1" ]; then
	echo "Usage:"
	echo "  tolower directory"
	exit 1
fi

cd "$1"
for i in `ls`; do
	lower="`echo "$i"|tr "[A-Z]" "[a-z]"`"
	if [ "$i" != "$lower" ]; then
		echo "$i" "->" "$lower"
		mv -i "$i" "$lower"
	fi
done
