Fixes folder handling, subfolders and issues with spaces and # on filenames.