in reply to Need efficient way to fetch 20 last modified files from folder

I guess there is some index by mdate in file system

Then most likely you guess wrong. Even if such an index exists in some versions of Windows for some disk format, it is not universally true.

Your best bet if you can is to restructure the directory layout so that you don't end up with large numbers of files per folder and can efficiently find stuff. Even better, if you have end to end control of this system, use a database for storing the file locations, touch times and other interesting meta data.

Another alternative is to use the file change notification system Windows provides to maintain a database of file touch times independently of the OS.

True laziness is hard work
  • Comment on Re: Need efficient way to fetch 20 last modified files from folder