Technology in terms you understand. Sign up for my weekly newsletter, "Confident Computing", for more solutions you can use to make your life easier. Click here.

Is There a Limit to What a Single Folder or Directory Can Hold?

//
Could you tell me if there is a size limit on a single folder? For example, a folder with movies or music in it could end up with quite a few gigabytes! Is there a limit?

There are limits, of course.

The limit most people run into first is the size of their hard disk, but assuming you have a big enough disk, other limits can come into play.

I will say this right away, though: the size of the files in a single folder turns out not to be one of them.

Become a Patron of Ask Leo! and go ad-free!

File size limits

There’s no practical limit on the combined sizes of all the files in a folder, though there may be limits on the number of files in a folder.

More importantly, there are limits on individual file size that depend on what file system your hard disk uses.

Overflowing FoldersFile systems

A file system is nothing more than the specification of how files are stored on disk. In practice, it is generally synonymous with “format”, as in, it’s a choice made when a disk is formatted. Limits are one factor in choosing which disk format to use.

FAT / FAT16

FAT, for File Allocation Table, is the successor to the original FAT12 file system that shipped with MS-DOS many, many years ago.

  • Maximum disk size: 4 gigabytes
  • Maximum file size: 4 gigabytes
  • Maximum number of files on disk: 65,517
  • Maximum number of files in a single folder: 512 (if I recall correctly, the root folder “/” had a lower limit of 128).

FAT32

FAT32 was introduced to overcome some of the limitations of FAT16.

  • Maximum disk size: 2 terabytes
  • Maximum file size: 4 gigabytes
  • Maximum number of files on disk: 268,435,437
  • Maximum number of files in a single folder: 65,534

NTFS

NTFS, or “New Technology File System”, was introduced with Windows NT, and is a completely redesigned file system now standard on most new Windows machines.

  • Maximum disk size: 256 terabytes1
  • Maximum file size: 256 terabytes
  • Maximum number of files on disk: 4,294,967,295
  • Maximum number of files in a single folder: 4,294,967,295

exFAT

exFAT is an extension of the FAT file systems originally designed for embedded systems and flash memory. While not as rich in features, it’s somewhat more cross-platform compatible and lighter weight than NTFS.

  • Maximum disk size: 128 petabytes
  • Maximum file size: 16 exabytes2
  • Maximum number of files on disk: 4,294,967,285
  • Maximum number of files in a single folder: 2,796,202

Disks versus disks

Note that when I say “disk” above, I’m really talking about “logical” disks, not necessarily physical ones. This shows up in two ways:

  • Disk partitioning can make a single physical disk appear as multiple logical disks.
  • Multiple physical disks can be arranged to appear as a single logical disk using various techniques, including RAID arrays or disk striping.

For example, no one (currently) makes a 256 terabyte disk drive, but using these techniques, you can treat a collection of disk drives as a single logical disk. NTFS is particularly suited to this task.

Pragmatic limits

Realistically, the size of your disk, or rather, the amount of available space on the disk, will almost always be the first limit you hit.

If individual files exceed 4GB, then avoid FAT, FAT16, and FAT32 file systems. NTFS and exFAT will handle individual files well over that size.

There’s really no limit of the aggregate size of the files in a folder, though there limits on the number of files in a folder.

Podcast audio

Play

Video Narration

Footnotes

1: This limitation may simply be an implementation restriction. I’ve read that the NTFS format can support disks up to 16 exabytes (16 times 1,152,921,504,606,846,976 bytes).

2: As I read the information (source: Wikipedia), this means that the maximum file size is larger than the maximum disk size, making the maximum file size a theoretical limit only.

25 comments on “Is There a Limit to What a Single Folder or Directory Can Hold?”

  1. Good article.

    Nitpick: your use of “terrabytes”: the prefix is actually ‘tera’, only one r; from the Greek ????? meaning four (since a terathing is 1000^4 things).

    (Of course, if I was being *really* nitpicky, you technically want ‘tebi’ (2^40) rather than ‘tera’ (10^12); but since few people know what ‘tebi’ means and the difference is less than 10% I’ll let you off there 😉 ).

    Reply
  2. —–BEGIN PGP SIGNED MESSAGE—–
    Hash: SHA1

    Thanks, fixed the spelling.

    Yeah, I consciously decided to avoid tebi for the very reason you mention. It
    might be more accurate, but if no one knows what it means, does it really help?

    (Yes, I also realize that actually using it would help further spread knowledge
    of the word. I’ll just claim that’s happening here in the comments.)

    🙂

    Leo
    —–BEGIN PGP SIGNATURE—–
    Version: GnuPG v1.4.6 (MingW32)

    iD8DBQFGSM5cCMEe9B/8oqERAonUAKCIgkWhc1lUlSa8fdkufWv2xxXIuwCfTO2X
    t5tSbaEeqScyb30w/8Vm35Q=
    =P8YB
    —–END PGP SIGNATURE—–

    Reply
  3. —–BEGIN PGP SIGNED MESSAGE—–
    Hash: SHA1

    Yes. Look into the “Convert” command. It’s a commandline tool that will convert
    a drive from FAT to NTFS. It’s included with Windows XP.

    Leo
    —–BEGIN PGP SIGNATURE—–
    Version: GnuPG v1.4.6 (MingW32)

    iD8DBQFGT7XBCMEe9B/8oqERAvnVAJ9CSZsW4wgjI6DKMkhKFigFUGkhAwCcDg42
    SslIOJQtTkR8/bpxSZRKBG0=
    =F57s
    —–END PGP SIGNATURE—–

    Reply
  4. Hi! Actually I’m keeping incurring in a folder size limit of 102 GB. I have several external drives, all of them NTFS, and there is no way to store more than 102 GB in a single folder. Any suggestion?
    Thanks

    Reply
  5. Cracking site and I’ve been trying to find out why I can only store a few Divx files in a folder before its full. No I know why and how to fix it. Cheers

    Reply
  6. I am creating an archive. Currently we are putting all of our files in one folder and have accumulated over 6,000 files. Is there a utility or piece of software that might have an inbox and place the files in automatically created directories with a maximum of 500 files to improve access performance.

    Reply
  7. Is it possible to put 1-2 thousand files in a folder in windows 2003 server and share it so that other users (more than 200) can directly execute exes from it. Or its a better idea to divide those files into sub folders inside the main folder. Thanks in advance.

    Reply
  8. Can you share resources for learning more about the optimal way to store files in a web application? We currently put all files into the main directory, and this is creating some issues with copying and we think backups. One folder has over 185,000 files, all of which are fairly small. The copy rate is about 6 gig/hour on a LAN.

    Reply
  9. My question and problem is this.. I have all my mp3 files cataloged in one directory.. which is about 30GB on a 1TB SATA drive.
    Im albe to play music just fine but if i wanted to open my directory where all my music is.. It takes like 5 mins to open..
    I realize it has to read all the files before opening the directory..
    So my question is this.. where is the fine line at.. how much can music or files can be store in one directory so it doesnt take you 20 years or longer to open?

    Reply
  10. There has to be some sort of size limit to folders. I have been copying DVD’s to my laptops hard drive, and had about 8 Movies on my hard drive, and when I tried to copy another DVD’s files over to that folder, I got a message that said something to the effect “There is not enough space in folder C:\…\….(… being the directory path), please make sure there is at least 4.2 Gb of free space. I thought it was a fluke and rebooted, and got the same message, but once I deleted one of the Movie folders, it then let me copy the files to that folder.
    Any thoughts?

    Reply
  11. I’m obviously missing something here. I have several movies stored on my FAT32 external drive that are way over 4 Gb. How can that be if the limit is 4Gb?

    If you mean DVDs or ripped DVDs you’ll often find that the movie is stored as several separate files, none of which exceed 2 gigabytes. FAT cannot handle large files, so either you don’t have FAT, or you don’t have large files.

    Leo
    17-Apr-2010

    Reply
  12. On a related matter, there are limits on the length of the full location of a file for some operations (I now forget which). So if you have a file which is

    C:\folder A\subfolder B\very long subfolder name C\ ….\some long file name as well.docx

    then there can be a limit of (128 or?) 256 characters for certain operations (like opening it in Word?). Very frustrating until you work out what the problem is. But some of the people commenting above may then hit this issue if they create lots of nested subfolders.

    Reply
  13. By the way, the limit to the number of files in a single directory is, if I’m remembering correctly, 2^4080, approx 1.5936e+1228 (in other words, you’d have to exhaust 255 characters of 16-bit unicode text in order to run out of space in a single directory).

    Reply
  14. It seems that the max number of files per folder in fat32 depends on the size of the clusters.
    In fat32, on my micro sdhc card, the max number of files within the root of a single folder is 21844.
    And I found this: “under FAT 32 provided partition with 4-kB-Clusters permits “only” max.
    21844 files per path”

    Source: http://www.staff.uni-marburg.de/~naeser/oe.htm

    Do you have more information about this phenomenon ? I didn’t find any.

    Thanks

    Reply
  15. That can’t be right for FAT. I have a 2GB usb flash drive, it has folder which has over 25,000 files in total, and over 13,000 in its root. So the “maximum number of files in single folder” is not right. Well, at least when I look drive properties there stands FAT. If the numbers presented are right, seems more like my drive had FAT32…

    Reply
  16. Well, we just watched a 2GB thumb drive frustrate my wife all afternoon, until we (a) found this thread here, and (b) verified 129 total items in the root level (2 folders, 127 files). Created a new subfolder, moved the files, and it’s back in business.

    Next thing you know, I’ll have to remember my 8 inch floppy single / double density formatting rules…

    thanks Leo!!

    Reply
  17. If you’re like me and never heard of an exabyte …
    KB ~ 1000 B (kilobyte)
    MB ~ 1000 KB (megabyte)
    GB ~ 1000 MB (gigabyte)
    TB ~ 1000 GB (terabyte)
    PB ~ 1000 TB (petabyte)
    EB ~ 1000 PB (exabyte)

    It’s a very big number!

    Reply
  18. There is a limit on the number of thumbnails, too. Recently, I hit this limit with my collection of photographs. Now, I have to recreate thumbnails each time in a current directory, because Windows quickly forgets them.

    Reply
  19. You’re very correct in stating “there limits on the number of files in a folder”.
    On a FAT32 drive, I once got Error 0x80070052
    It took some time to figure it out… too many files-with-long-names in one folder.
    Somewhere on the web I found this as the cause: “A FAT32 directory can have 65,536 directory entries. Each file and subdirectory takes from two to thirteen entries, depending on the length of its name, so those entries can disappear long before you think you’ve used them all up. Its entirely possible that you have hit your limit with 15,610 files due to filename length.”

    I’m not sure what the limits on NTFS are.

    Reply

Leave a reply:

Before commenting please:

  • Read the article.
  • Comment on the article.
  • No personal information.
  • No spam.

Comments violating those rules will be removed. Comments that don't add value will be removed, including off-topic or content-free comments, or comments that look even a little bit like spam. All comments containing links and certain keywords will be moderated before publication.

I want comments to be valuable for everyone, including those who come later and take the time to read.