read contents of a folder and write the filenames to a text file