What is a Directory Tree?

WinDirStat

What is a Directory Tree?

On most computer operating systems, so on Microsoft Windows, the data on the hard disk are organized hierarchically.

On the one hand there are the files which have a certain size and contain the effective data. Each file has a name. Under Microsoft Windows the "filename extension" informs about the type of the file. The extension ".exe", for instance, indicates that it's a program file. The extension ".doc" indicates a WinWord document, ".jpg" is a photo, and so on. But ridiculously the Microsoft Windows Explorer hides these filename extensions by default. You can change this behaviour in the options menu of the Windows Explorer.

On the other hand there are directories. The Windows Explorer and WinDirStat, too, symbolize directories as yellow folders. Directories also have a name, but normally without a filename extension. Directories only serve to contain files and other directories ("sub-directories"). Due to the fact that directories can contain subdirectories, and those again can contain subdirectories, the result is a hierarchical structure on the disk.

Instead of "hierarchical structure" we simply say tree structure. Since a tree is built hierarchical as well: The trunk branches out into branches, the branches into sub-branches, twigs and finally into the leaves. In a file system the so called root directory is the trunk, the directories are the branches and the files are the leaves.

That's why we call the file system of a computer simply a "directory tree".

Unlike most real trees, on a disk the trunk and the branches already have leaves. And, unlike most real trees, too: the files are the voluminous entities (the size of which is measured by megabytes or gigabytes), whereas the actual directories are neglectibly small. By the way, we imagine abstract trees as turned round: the root at the top, the leaves at the bottom.

If you saw a branch off a tree and stick it into the earth, then it becomes itself a little tree (well, at least it looks like one): Every branch is, together with its sub-branches and leaves, itself a tree, a subtree.

The family tree metaphor is often used as well: The subdirectories and files of a directory are called its children. And a directory containing a subdirectory or file is called their parent. The root directory is earliest ancestor of all items in the directory tree.

A path like "C:\documents\letters\draft\loveletter.doc" indicates that on the hard disk C:, in the root directory "C:\" there is a directory "documents", under it the subdirectory "letters", under it a subdirectory "draft" and in there a file "loveletter.doc". So the path is a precise representation of the way from the root to the leaf.