Add support to export metadata, fix issue with long filenames