Shell script for operating on files in a folder and subfolders