Just to clarify it a little more (hope i do not miss any special filesystem):
Folders are a small file
Folders grow as more files / sub folders are added to it (but not to a sub folder of it), only directly to it
Folders (on some systems do not) decrease on size when files / sub folders directly on it are removed from it
Think on folders as a phonebook list
Most filesystems leave empty entries on folders (just to not move all the rest up), so size most of the times only grows
Folder size does not include any file size (unless such folder is a container where talking about free space may have a meaning: size to reach max container size)
Folder size depends on the number of entries (including the ones than have been blanked) ceiling it to a multiply of a number
Folders does not hold inside it any content of any file (except special folders that are really a container, with or without a max size defined)
At least for FAT12, FAT16, FAT32, exFAT, NTFS, ext, ext2, ext3, ext4, and maybe for much more filesystems, folders are a small file that identifies what folders and files are under it, just like a phonebook list, it only describes what is inside it (beware: only directly on it, nothing about what is inside any sub folder).
NTTS has some extra things, but all has it's unique identificator (a number), folders identify only what of such identificators are just directly on such folder, not the ones that are in a sub folder of it, etc.
Beware there are filesystems very special, on that ones a Folder can have a size (upper limit) and so it has sence to talk about free space inside that folder.
For most Linux users to understand that, treat such Folder as a Container with a max size, concept is near the VDI files of VirtualBOX, etc. They can grow up to a limited size. Some special filesystems use that concept for a Folder, while others (like Pismo Private Folders) use a no max size limit.
For most Windows users to understand that, treat such Folder a a sparse big file, that with some 3rd part tool is seen as a folder.
In other words, the are three common well defined type of thing on a file system (including some special filesystems not so much common to see):
Files (hold information, or links to other files)
Normal folders, they are really a small file (hold a list of what is directly on its 1st level inside them)
Special folders, they can be seen as a huge file, with or without an upper size limit (holds all what is inside them, list and content of all, including sub folders, etc); not all filesystems allow them natively, most use the trick of defining a file and then mount it as if it where a folder (like .zip, .rar, .7z mounter utilities, etc), but a few filesystems allow them natively.
If you want to see something very weird, try this (on a NTFS):
Create a folder on the root, called for example: MyWeirdFolder
Then inside it create a sub folder with a very large name (more than 200 characters)
Create another folder, but with a short name, like WillBeRenamed
Move the long one inside the short one
Rename the short one to a very long name (more than 200) characters
You will get a path that is not accesible due to very long path, just rename such long names to shorter ones and will get access to it again.
Folders are as big as the total size of their contents; they do not have any free space.
The
df
command shows empty disk space.There is no meaning of a folder size. In really a folder/directory is just a File in Linux as the concept everything is a file in Linux.
So a folder is a file of files. I,e it's just a place to hold files, though it has no size, its size is related to the size of files inside.
So, there is nothing called free space on a folder.
You can know the size of a directory
also you can know the free space of your whole filesystem
Just to clarify it a little more (hope i do not miss any special filesystem):
At least for FAT12, FAT16, FAT32, exFAT, NTFS, ext, ext2, ext3, ext4, and maybe for much more filesystems, folders are a small file that identifies what folders and files are under it, just like a phonebook list, it only describes what is inside it (beware: only directly on it, nothing about what is inside any sub folder).
NTTS has some extra things, but all has it's unique identificator (a number), folders identify only what of such identificators are just directly on such folder, not the ones that are in a sub folder of it, etc.
Beware there are filesystems very special, on that ones a Folder can have a size (upper limit) and so it has sence to talk about free space inside that folder.
For most Linux users to understand that, treat such Folder as a Container with a max size, concept is near the VDI files of VirtualBOX, etc. They can grow up to a limited size. Some special filesystems use that concept for a Folder, while others (like Pismo Private Folders) use a no max size limit.
For most Windows users to understand that, treat such Folder a a sparse big file, that with some 3rd part tool is seen as a folder.
In other words, the are three common well defined type of thing on a file system (including some special filesystems not so much common to see):
If you want to see something very weird, try this (on a NTFS):
MyWeirdFolder
WillBeRenamed
You will get a path that is not accesible due to very long path, just rename such long names to shorter ones and will get access to it again.