WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Miscellaneous

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Directory Limits


Question:

Recently there has been a question at work asked about how many 'Folders' an NTFS file system can store. -- I have done a quick search on Microsoft.com -- and I was unable to find how many folders you can create. -- I believe that you can have a folder go up to 144 folders DEEP. --(Like C:\Folder\Folder1\Folder2\Folder3.... \Folder144) before it maxes out…

However how many folders can an entire volume (‘C:\’) Hold? For example. C:\Folder1, C:\Folder2, C:\Folder3, ETC…

So I would like to test this by making a winbatch script that will create a 'C:\Folder1 C:\Folder2. C:\Folder 3... all the way too infinity. Until either something crashes. Or windows research a maximum folder limit....'

OR! -- If someone out there knows the exact folder limit on an NTFS volume! -- I would love to know!!!

Answer:

Well I do know that of a FAT file system, there is a rather low limit for the numbers of folders allowed off the ROOT. I think combination folders and files is 255) (and 511 for a hard drive). As far as subdirectories off the root, I do not know of any limits. (any my guess is that if there were limits...I would know by now)

Limits, if any, would likely be either about 65535 or slightly over 2.1 billion

( (2**16)-1 and (2**32)-1 )
I have never heard of a limit of any kind on a NTFS file system. There is volume capacity imposed limits where you simply run out of disk space to store more folder entries, but then with a larger hard drive...well then you can store more.

Also...keep in mind...that a "legal" file name as in

c:\this\that\other...\more\stuff\filenamr.txt
should not exceed 255 characters. It turns out that this is not strictly enforced, so that you can sometimes make longer than 255 file names, but then later find that your backup program chokes on them.

thus... if you make a folder structure like

c:\a\a\a\a\a\a\...\a\a\a\a\a\a\a\a\a\x
you should not go more than 126 levels deep (less that 144 levels)

It is usually best not to stress test those limits.

In further research in FAT and FAT32 there seems to be a limit of 65535 combined folders and files in one directory (other than the root)

No limits seen for NTFS

Finally, file specifications in ANSI are limited to 255 characters. If you get down & dirty with some of the Unicode versions of the Win32 API functions, though, you can use a special prefix "\\?\" on the front of a UNC spec to make it virtually unlimited in length.


Article ID:   W16500
File Created: 2005:02:18:12:21:02
Last Updated: 2005:02:18:12:21:02