Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Directory Enumerator for folder having files with path length beyond 260 bytes

Directory Enumerator for folder having files with path length beyond 260 bytes

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sandeep Vaidya
    wrote on last edited by
    #1

    How to implement the dirctory enumerator for the directory having files with the path length more than 260 bytes?. WIN32_FIND_DATA structure used in the FindNextFile() limits the cFileName to MAX_PATH which is defined as 260. If we are trying to implement the directory enumerator for the Japanese language, then it is quite possible to have paths beyond 260 bytes. During that time, FindNextFile will fail to get the elements. Please let me know for any work around for the same. Thanks in advance -Sandeep

    W M 2 Replies Last reply
    0
    • S Sandeep Vaidya

      How to implement the dirctory enumerator for the directory having files with the path length more than 260 bytes?. WIN32_FIND_DATA structure used in the FindNextFile() limits the cFileName to MAX_PATH which is defined as 260. If we are trying to implement the directory enumerator for the Japanese language, then it is quite possible to have paths beyond 260 bytes. During that time, FindNextFile will fail to get the elements. Please let me know for any work around for the same. Thanks in advance -Sandeep

      W Offline
      W Offline
      Waldermort
      wrote on last edited by
      #2

      Instead of using MAX_PATH use a Unicode string.

      1 Reply Last reply
      0
      • S Sandeep Vaidya

        How to implement the dirctory enumerator for the directory having files with the path length more than 260 bytes?. WIN32_FIND_DATA structure used in the FindNextFile() limits the cFileName to MAX_PATH which is defined as 260. If we are trying to implement the directory enumerator for the Japanese language, then it is quite possible to have paths beyond 260 bytes. During that time, FindNextFile will fail to get the elements. Please let me know for any work around for the same. Thanks in advance -Sandeep

        M Offline
        M Offline
        Michael Dunn
        wrote on last edited by
        #3

        A Unicode app can create a file with a full path longer than MAX_PATH characters, but cFileName is not the full path, it's just the name+extension of whatever was found. This cannot exceed MAX_PATH TCHARs.

        --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

        S 1 Reply Last reply
        0
        • M Michael Dunn

          A Unicode app can create a file with a full path longer than MAX_PATH characters, but cFileName is not the full path, it's just the name+extension of whatever was found. This cannot exceed MAX_PATH TCHARs.

          --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

          S Offline
          S Offline
          Sandeep Vaidya
          wrote on last edited by
          #4

          Windows allows to create the file names beyond 260 bytes ( allows upto 255 characters). If we take the japanese OS, file name and extenstion with 150 characters can take more than 300 bytes. This is something cFileName cannot handle I think. Any suggetions on this front?. Thanks in advance Sandeep

          M S 2 Replies Last reply
          0
          • S Sandeep Vaidya

            Windows allows to create the file names beyond 260 bytes ( allows upto 255 characters). If we take the japanese OS, file name and extenstion with 150 characters can take more than 300 bytes. This is something cFileName cannot handle I think. Any suggetions on this front?. Thanks in advance Sandeep

            M Offline
            M Offline
            Michael Dunn
            wrote on last edited by
            #5

            Sandeep. Vaidya wrote:

            Windows allows to create the file names beyond 260 bytes ( allows upto 255 characters).

            How are you doing this? I'm unable to do it in Explorer, and the docs on file names[^] say each component of the full path can't exceed MAX_PATH characters (note: unicode characters, not bytes).

            --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

            1 Reply Last reply
            0
            • S Sandeep Vaidya

              Windows allows to create the file names beyond 260 bytes ( allows upto 255 characters). If we take the japanese OS, file name and extenstion with 150 characters can take more than 300 bytes. This is something cFileName cannot handle I think. Any suggetions on this front?. Thanks in advance Sandeep

              S Offline
              S Offline
              Sandeep Vaidya
              wrote on last edited by
              #6

              I Have a folder folder1 created in the desktop in Japanese OS. I have folder2 created inside folder1. Length of the full path for folder2 is 244 characters ( not bytes). It has some files also and the complete path is within the 260 characters ( not bytes). If I start the enumeration on the top folder i.e folder1, I get the next file sproperly for all other files. when it comes to folder2, FindNextFile() return zero. I tried the GetLastError() and found that it is not ERROR_NO_MORE_FILES.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups