Sort the filenames while iterating them