FindFirst - Directory Sort Order

Posted on 2003-03-16
Medium Priority
Last Modified: 2013-11-20
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.
Question by:TheShark8
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 48

Accepted Solution

AlexFM earned 400 total points
ID: 8146280
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question