15

How much space empty directories take?

In Windows and NTFS file system it say '0 bytes' which is impossible.

How much is really taken up by a directory? Does it depend on the file system or operating system?

10
  • 1
    Technically what the Properties Window is showing you is the contents of the folder, that if empty occupy 0 bytes on any disk. Your question deals on what space the folder structure occupies on a filesystem. It is obviously dependent on filesystem. On FAT32 the only things you need to store are some flags (hidden, archived) and the name and path. In NTFS you also need to store permissions and some more things. All in all, that space is near negligible. – Doktoro Reichard Dec 1 '13 at 22:58
  • So, on the NTFS, how much space an empty diractory takes? e.g. if i make 1 billion directories, how much space this is? –  ShadowHero Dec 1 '13 at 22:59
  • As I said, depends on the name and folder path. Assuming you use all 26 characters, with 1 billion unique names you can have about 7 character length folder names. So, 7 Bytes * 1.000.000.000 equals roughly 7GB of space. This is a minimum, I would suppose. I think I have about 1 million folders in all my drives so that value isn't even reached in reality. Don't forget this is a very rough estimate. – Doktoro Reichard Dec 1 '13 at 23:03
  • Cool, I see... how permissions are stored? –  ShadowHero Dec 1 '13 at 23:05
  • 1
    @AthomSfere Hmm... that would mean that folders can't store infinite user permissions, unless multiple MFT records can be assigned. Will try to look it up. – Doktoro Reichard Dec 1 '13 at 23:24
18

Technically what the Properties Window is showing you is the contents of the folder, that if empty occupy 0 bytes on any disk.

Your question deals on what space the folder structure occupies on a filesystem, which is obviously dependent on it. On FAT32 the only things you need to store are some flags (hidden, archived) and the name and path. In NTFS you also need to store permissions and some more things. All in all, that space is near negligible.

The space an empty directory structure occupies depends on the name and folder path. As an example, assume you place all folders on a root drive (say C:) and use all 26 alphabetic characters; with 1 billion unique names you can have log_26 (1.000.000.000) = approximately about 7 (6.3065) character length folder name. So, 7 Bytes * 1.000.000.000 equals roughly 7GB of space.

This is a minimum based only on the amount of space names have to take on any structure. As it will be shown, filesystems store a lot more information other than filename on its' file structure.

I think I have about 1 million folders and files in all my drives so that value isn't even reached in reality. Don't forget this is a very rough estimate.


The most used filesystems at current time can be considered (arguably) as FAT (File Allocation Table) and NTFS (New Technology File System). FAT as we know it has been in use ever since 1996, when Windows 95 was released with FAT32. Although replaced by other, more resilient filesystems, such as NFTS (Windows), HFS+ (OSX) or ext3 (Linux), it is still widely used in handheld devices or in memory cards or flash drives, as it is well supported by most OS and above all, it's simple.

Now for what matters. Files and directories in a FAT partition, even if they have nothing in them, have a name, a location, certain attributes, etcetera, that are stored in a zone called directory table.

The directory table is a special file (i.e. it is hidden from regular use, such that only the OS and certain applications can directly access it). It represents a directory (aka folder) and any file or folder stored within it has a 32 Byte entry in the table. As the directory table is a file, it then occupies one or more clusters (i.e. boxes with a preset size within a disk, where only a single file (or a part of one) fits).

So, any folder or directory, on a modern drive (>512 MB), has at least an overhead of 4 KB, so as to store the table (source). However, this means you can store 128 different files (4 * 1024 B / 32 B = 128) on the same folder and the overhead in storing the records is still the same 4KB as before.

Piggybacking on the first example, this would mean that the billion folders would have an overhead of 32 GB, rather than the roughly estimated 7 GB I calculated. These 32 GB store not only the short name (8 ASCII characters), but the attributes, flags, access, creation and modification dates and other legacy attributes.

Assuming you read all this, there might be a question you might have: "Well this is all well and good but how are long names, such as Wabbajack or even hashy names such as e4d909c290d0fb1ca068ffaddf22cbd0, stored?"

Microsoft in Windows 95 decided to add that feature to enhance user experience. To avoid breaking a "near-standard" system, they used a neat workaround called VFAT (Virtual FAT). Essentially in order to fit the long file name into the file, additional records were written before the actual file record (with some special attributes as not to be seen by earlier systems). The long filename system allows a maximum length of 255 UTF-16 (Unicode) characters (source) (source).

If you were to change the first example such that every folder had 9 characters, then the overhead would double from 32 GB to 64 GB, as one more record would need to be written to store the long name.


According to the Wikipedia article about NTFS, all permissions are stored in the Master File Table. It's space can be seen apparently through the Disk Defragmenter, as shown on here.

The size a MFT record occupies from both a folder or a file, is described in here:

File and folder records are 1 KB each and are stored in the MFT, the attributes of which are written to the allocated space in the MFT. Besides file attributes, each file record contains information about the position of the file record in the MFT.

When a file’s attributes can fit within the MFT file record for that file, they are called resident attributes. Attributes such as file name and time stamp are always resident. When the amount of information for a file does not fit in its MFT file record, some file attributes become nonresident. Nonresident attributes are allocated one or more clusters of disk space. A portion of the nonresident attribute remains in the MFT and points to the external clusters. NTFS creates the Attribute List attribute to describe the location of all attribute records. The table NTFS File Attribute Types lists the file attributes currently defined by NTFS.

So, in NTFS, folders occupy at least 1 KB of space, unless they have very long argument and permission lists; at that point, the MFT record occupies an additional cluster in the partition, the size of which depends on how it was formatted, although for more than 2GB Microsoft in that post recommends 4KB clusters.

3
  • 1
    I found some information on the 1024 Byte length I mentioned earlier, c-ad.bnl.gov/kinyip/windows/MFT.html It is a very good read and might benefit your answer if you care to expand. – Austin T French Dec 1 '13 at 23:32
  • I would like to expand (to make this a more complete answer, without this being too technical...) although I would have to leave this for tomorrow. Thanks for that source anyway. – Doktoro Reichard Dec 1 '13 at 23:52
  • Technical correction: there is no 255 path limit. Rather, there is the MAX_PATH limit of 260 characters for standard paths, and then there is the extended-length path of 32,767 characters (yes, over 32 thousand characters) for true unicode paths (using the `\\?` indicator, either as plain extended-length path, or as UNC path). See docs.microsoft.com/en-us/windows/win32/fileio/… for more details on this. – Mike 'Pomax' Kamermans Oct 30 '19 at 23:59
3

For a real world example, I just recorded my free space, then I created a large directory structure and subtracted the new free to find how much space was used. I created directories 0-6 for each day of the week, then inside directories 0-23 for hours of the day, then 0-59 for minutes of the hour. In total its 10,080 directories. My disc usage changed by 6,926,336 bytes. That works out to 687 bytes per directory. In case you care, that also works out to 0.0006% of a 1TB drive (if you calculate 1TB as 1024^4).

1
  • 4
    Can you add the file system to your answer? The directory names were all short? – fixer1234 Jun 16 '16 at 19:41
0

On Windows 10 I created 1,000,000 empty folders and, according to python's getsize function, it took up 200540160 bytes of space. That's an average of 200.54016 bytes per folder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.