Announcement

Collapse
No announcement yet.

Limit on number of files in FAT32

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Limit on number of files in FAT32

    I have created a document management program using PBDLL. The
    program can create a lot of page files and save them on CD's or
    in hard drive partitions. To test hard drive capacity I wrote a
    small program which simply copies a "TestFile.Dat" 60,000 times
    to a "I.Dat" file where I varies from 1 to 60,000. The file size
    was 99,000 bytes and the partition was 8 Gb. At "I"
    approximately equal to 32,700, the copying process and the
    message was "Cannot make directory entry". There was over 4 Gb
    unused space in the partiton. Removing one file allows one file
    to be added and that's it. I bumped the size of "TestFile.Dat"
    to 400,000 and filled the partition, this time running out of
    space and using less than 32,700 files, as it should be. I have
    tested several large partitions on several machines with the
    same results.
    Question: Why I am being stopped at <32,700> when the size is
    small?



    ------------------

  • #2
    seems like you use a for next loop where 'I' is an integer
    with a max-value 32.767
    Change it to a long instead


    ------------------
    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se

    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se

    Comment


    • #3
      Fred,
      I wish it was that easy. "I" was already "Long". From Windows
      Explorer or from DOS there is no putting another file into that
      partition. Using Partition Commander it's possible to create
      another 4 Gb partition and drop more files but that's bypassing
      the problem.

      Thanks
      Bob

      ------------------

      Comment


      • #4
        I notice you got "text" messages rather than numbers.

        How are you "copying" the file? By SHELL?

        Why don't you try opening for output under PB control, or using the CreateFile(Ex) APi call and interrogating the numeric code?

        That might give you an error number you could look up and maybe get some better guidance.

        MCM
        Michael Mattias
        Tal Systems Inc. (retired)
        Racine WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          There's a known limit on NTFS of something like 20,000 files in one directory....

          Not sure about FAT32 tho


          Scott

          ------------------
          Scott
          mailto:[email protected][email protected]</A>
          Scott Turchin
          MCSE, MCP+I
          http://www.tngbbs.com
          ----------------------
          True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

          Comment


          • #6
            Robert;

            There are limits to the number of files.

            Non-FAT32 format hard drives have a limit of 65,536 clusters
            (form a block storage used by the harddrive). A 4 GIG harddrive can
            use as much a 65,536 bytes per cluster. This means a file with 1 byte,
            still uses 65,536 bytes on the harddrive. You can't store data from two
            different files in the same cluster.

            I do not know the exact limit on the number of files, but there
            obviously is one, since a harddrive is limited in the number of clusters
            and the cluster size is fixed. Now, whether FAT32 gets around this
            limit, I do not know.


            ------------------
            Chris Boss
            Computer Workshop
            Developer of "EZGUI"
            http://cwsof.com
            http://twitter.com/EZGUIProGuy

            Comment


            • #7
              Another possibility - the 8.3 filename Windows allocates for each file you create.
              Considering the way Windows generates these names (LongFilename.dat -> LONGFI~1.DAT; LongerFilename.dat -> LONGFI~2.DAT etc), and considering also that your filenames are purely numeric, I can't see how Windows could fail to run out of 8.3 filenames sooner or later.

              Without actually thinking about it, I would say that this limit would be reached rather later than the limit you've found. However, if instead of I.dat you did XXI.dat, where XX is a pair of randomly selected letters, that should be a work-around.

              ------------------
              --Dan
              Dan

              Comment


              • #8
                Hi Robert,
                Were you doing this on a root directory? I'm a little fuzzy on
                this, but I think the root directory has a limit and subdirectories
                don't? Just a thought....

                ------------------
                [email protected]

                Comment


                • #9
                  Scot, Wyman,

                  Bingo. And I knew that, so shame on me.
                  FAT has a limit of 500 files in the root directory.
                  FAT32's limit, for some reason I have yet to figure out, can
                  vary. In one test I varied the size of files from 30,000 to
                  150,000 bytes in size and came up with a limit of 48,356 files
                  using less than 4 Gb on a 20 Gb drive. In another case I set
                  each file size to 99,000 and got stopped at 32,700 on a 8 Gb
                  drive.

                  In any case, I took your advice, erased one file in the root
                  directory, created a new file called a "folder" and walla it
                  started accepting files to fill up the rest of the 20 Gb.

                  FAT32 is more efficient than FAT in that the allocation units
                  are 4,096 bytes in size rather than 65,505. I'd rather use
                  ten FAT32 units for my 40,000 byte file than 1 FAT unit and lose
                  15,505 bytes.

                  Thanks

                  ------------------

                  Comment


                  • #10
                    While the number of files in the root directory is fixed,
                    it is not always going to be the same. Programs like
                    Partition Magic are able to change the number of files
                    allowed in the root directory.

                    ------------------
                    Thanks,

                    John Kovacich
                    Ivory Tower Software

                    Comment

                    Working...
                    X