

for i in $(find . -name '*src.rpm'); do
	rpmname=$(basename $i)
	dirname=$(dirname $i)
	topdir=$(basename $dirname)
        first_letter=${rpmname:0:1}
	first_letter_lower=${first_letter,,}
	# echo "dirname $dirname    rpmname $rpmname    topdir $topdir     first_letter_lower $first_letter_lower"  
	if [[ $topdir == "Packages" ]]; then
		echo "found $rpmname in Packages checking if it exists in $dirname/$first_letter_lower"
		if [[ -e "$dirname/$first_letter_lower/$rpmname" ]];  then
			echo "Sorry this file already exists! Removing"
			rm $i
		else
			echo "moving mv -i $i $dirname/$first_letter_lower"
			mv -i $i $dirname/$first_letter_lower
		fi
	fi	
done	
