A working write-to-file of folder and file names

Finally fixed recursive, as it only wrote file names to console, now it
writes folder names and file names into a file. It writes the files of
the root folder, then it writes subfolder name and recursively the file
names and sub folders.