Fixed bug with file deletion

File deletion was running in for loop over directory and subdirectories,
so the wrong file paths were being checked for file existence at times.