sort filenames so merging works correctly