How much space do directories consume?
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?
Solution 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, 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.
Solution 2:
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).