• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 367
  • Last Modified:

FindFirst - Directory Sort Order

How can I change the directory sorting order (in the file system). for example if the directory is order by name and I want it to be order by date. (I need it for the FindFirst Method that returns the files in that order).
everything should be done from the code.
please write me down a code example or the API function name.
The Shark.
1 Solution
If you mean FindFirstFile/FindNextFile, it is impossible to define the order of files. You need to solve this problem in the data structure where you keep the files.
For example, if you keep file names in std::vector, you need to sort this vector after it is filled. To sort files by date keep file creation/last access time together with file name (this time is available in WIN32_FIND_DATA structure).

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now