Is there a limit to the number of files I can place in a given folder?

19

2

How many files can a folder contain? I have 30k folders inside 1 folder. Each of the folders has 1 image file. Is there a limit on the number of files a folder can store?

I am using Windows Server 2003, IIS6.

curiousdev

Posted 2010-02-03T13:43:43.783

Reputation:

Answers

22

Note: Assuming NTFS, as no one in their right mind would use FAT for anything else than USB thumb drives or memory cards, let alone on a server (ok, that thought is scary).

Yes, there is a limit. Storing more files than particles in the universe may prove impractical. However, the actual limit is far lower.

NTFS has a maximum of 4,294,967,295 (232 − 1) files per volume. A few of those are already used by the file system itself and folder should count as files too.

30,000 aren't that many files, actually. But Microsoft recommends that you turn off auto-generation of DOS-compatible short names if you move past 300,000 as finding a unique short name gets difficult then.

Joey

Posted 2010-02-03T13:43:43.783

Reputation: 36 381

I was looking for this info. I just had to drop to DOS 8.3 short names for a program I'm working with in which I exceeded a filepath character limit. I started thinking there could be some limitations. Then I realized that after a few similar files they start using 4 character hashes. There are (26+10)^4=1679616 possible names then. I tried stumping it by renaming a file to another file's shortname, but it converted it behind the scenes and basically said "File Exists. LooooongName (2) instead?". Since I don't plan to get anywhere near 300000, I'll be fine! Interesting stuff! – flutefreak7 – 2014-09-10T04:10:57.040

Hmm the recommendation applies to NT 3.5. It does not mention any new Operating Systems. – Ganesh R. – 2010-02-03T14:40:22.763

2That fact hasn't changed since then. Short name generation is still there and the underlying problem of finding a short name still remains once there are too many of them—simply because they are ... well ... short :-) – Joey – 2010-02-03T17:58:57.643

16

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 filesystem you're using on your hard disk. (The "filesystem" is nothing more than the specification of exactly how files are store on disk.)

Let's break this down by file system:

•FAT aka FAT16

FAT, for File Allocation Table, is the successor to the original FAT12 filesystem 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

"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."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" introduced with Windows NT, is a completely redesigned file system.

◦Maximum disk size: 256 terabytes

◦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

Note that when I say "disk" above, I'm really talking about "logical" disks, not necessarily physical. No one makes a 256 terabyte disk drive, but using NTFS you can treat an array of disk drives as a single logical disk. Presumably if you have enough of them, you can build a huge logical drive.

Also note that the NTFS's 256 terabyte limitation may well 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).

Source

r0ca

Posted 2010-02-03T13:43:43.783

Reputation: 5 474

1You may want to site your source. – John T – 2010-02-03T13:55:33.100

If max disk size for FAT32 is 256 terabytes, then why the limit of 32 GB for making a partition? – Ganesh R. – 2010-02-03T14:37:16.373

@GaneshR. it's only the artificial limit of the format program in Window XP and up. All other formatters have no problem creating a large FAT32 partition. Probably because they want people to change to NTFS. That's a goold thing, because NTFS are much better than FAT32 at handling files: bigger drives, bigger file sizes, better fault tolerance (due to journal), smaller cluster size for big drives, faster file seeking/opening (due to the B-tree structure), better performance for very big files and very small files... There's almost no reason to use a big FAT32 partition nowadays – phuclv – 2017-03-16T03:54:30.693

2

You can only have a maximum of 65535 files in the windows temp directory, otherwise the .Net Framework method Path.GetTempFileName will stop working. Deleting previous temporary files will allow it to work again until the limit is reached once more

See: Path.GetTempFileName

AgentNaz

Posted 2010-02-03T13:43:43.783

Reputation: 21

0

If you're using NTFS, then no, there is no real limit.

Performance will suffer in other ways: trying to open a folder with 30k sub-folders will suck enormous amounts of time.

FATXX has limits.

Other modern file systems, no real limit.

SuperMagic

Posted 2010-02-03T13:43:43.783

Reputation: 935

1Where do you get the idea that 30k subfolders "sucks enormous amounts of time"? Opening such a folder (with 50k subfolders) takes a second in Explorer, another second to sort correctly. In FAR Manager it takes about 1 second to open that folder. – Joey – 2010-02-03T13:59:49.143

2I can see why he would say that. If you are using thumbnail view, Windows will attempt to display a thumbnail of the contents of each folder. Though in thumbnail view you're unlikely to see more than a dozen or so folders on screen at any one time. – Kenneth Cochran – 2010-02-03T14:45:27.680

Yes, I though of that after I'd written this. A view of folders won't take long. Thumbnail view... will. – SuperMagic – 2010-02-03T16:40:32.160

thumbnails should be disabled on big folders – phuclv – 2017-03-16T03:56:10.157