Is there a limit to the number of files I can place in a given folder?
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.
Solution 1:
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.
Solution 2:
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
Solution 3:
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