Small correction: change for b in $(find . -type f -name "*.$a";do to for b in $(find . -type f -name "*.$a");do I left out the closing bracket. Tez