How to Get The Files datewise using FindFirstFile Function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • haneeshkb
    New Member
    • Nov 2007
    • 23

    How to Get The Files datewise using FindFirstFile Function

    I am using the function FindFirstFile to pick files from a folder to process. But the files selecting is based on name ,I need to get the files selected based on datetime( means frst come firstout ). Is there any option with FindFirstFile or any other function is there that I can use with c++? please help me...
  • newb16
    Contributor
    • Jul 2008
    • 687

    #2
    Actually they aren't sorted at all, that can be checked in documentation. You must sort them by yourself - by name, date or whatever.

    Comment

    • Laharl
      Recognized Expert Contributor
      • Sep 2007
      • 849

      #3
      I believe FindFirstFileEx allows for more selective searching, but I've never looked at its docs...Google is your friend.

      Comment

      • haneeshkb
        New Member
        • Nov 2007
        • 23

        #4
        Originally posted by newb16
        Actually they aren't sorted at all, that can be checked in documentation. You must sort them by yourself - by name, date or whatever.
        I can't able to seen any sorting options in FindFirstFile

        Comment

        • haneeshkb
          New Member
          • Nov 2007
          • 23

          #5
          Originally posted by Laharl
          I believe FindFirstFileEx allows for more selective searching, but I've never looked at its docs...Google is your friend.
          Anybody is there to help me in this problem?

          Comment

          • newb16
            Contributor
            • Jul 2008
            • 687

            #6
            Originally posted by haneeshkb
            Anybody is there to help me in this problem?
            You must sort them by yourself - by name, date or whatever.

            Comment

            • piyaca
              New Member
              • Sep 2008
              • 2

              #7
              From MSDN: "The search is performed strictly on the name of the file, not on any attributes such as a date or a file type"

              I suggest building a list of all files in the directory and then using GetFileAttribut esEx on each file. This can populate a WIN32_FILE_ATTR IBUTE_DATA structure with everything needed to sort the files how you want (eg. date/time).

              Comment

              Working...