Bash script to run iteratively over files in folders