#!/bin/bash
#
#	recursive_lower
#	written by Jan Engelhardt, 2004-2007
#
#	This program is free software; you can redistribute it and/or
#	modify it under the terms of the WTF Public License version 2 or
#	(at your option) any later version.
#

descend_into()
{
	for src in "$@"; do
		dest="`echo -en \"$src\" | tr A-Z a-z`";
		mv "$src" "$id" && \
		mv "$id" "$dest";
		echo "$src" "->" "$dest";
		if [ -d "$src" -o -d "$dest" ]; then
			descend_into "$dest"/*;
		fi;
	done;
	return;
}

id=`mktemp -u .tmp.$$.XXXXXXXX`;
descend_into "$@";
