order file by last matched index