potresti
inserire i nomi dei files in un'array
quindi ordinarlo
e recuperare l'ultimo valore