Sometime ago I wrote a simple script to run over a directory tree recursively.
Here it is. I think you can adapt it to your problem easily.
for file in *
do if [ -d $file ]
then echo "Descending into $file"