The original code didnt account for the files in the selected directory itself