Currently I am using dirent.h to iterativly access files in a directory and its sub-directories. It accesses them according to their file names (alphabetically). For some reason I want to access the subdirectories and the files according to their modification time (with the latest modified file being accessed at last). Is it possible to do so?
I am thinking to first traverse through the directories and create a sorted list of the files according to their modification time and use this list to read them accordingly. But I was hoping if there is a better way.