Fix input filenames and save result to file