[ The PC Guide | Systems and Components Reference Guide | Hard Disk Drives | Hard Disk Logical Structures and File Systems | FAT File System Disk Volume Structures ]

Internal Directory Structures

Every file on the hard disk is stored in a directory. A directory is nothing more than a file itself, except that it is specially structured and marked on the disk so that it has special meaning to the operating system. A directory is a table that contains information about files (and subdirectories) that it contains, and links to where the file (or subdirectory) data begins on the disk. The paper analogy would be a table of contents to a book, except that directories of course use a hierarchical tree structure and books do not. (In some ways, a better analogy would be this web site itself; each index frame points to either individual pages, or another sub-index. The PC Guide is hierarchical in the same way as a PC's directory structure, and the home page would be the equivalent of the root directory.)

Each entry in a directory is 32 bytes in length, and stores the following information:

  • File Name and Extension: This is the 11-character name of the file using the conventional 8.3 DOS file naming standard, for example, COMMAND.COM. Note that the "dot" in "COMMAND.COM" is implied and not actually stored on the disk. See here for more on file naming and also on VFAT long file names, which use a special structure. The file name field is also used to indicate directory entries that have been deleted.
  • File Attribute Byte: There are several different attributes which the operating system uses to give special treatment to certain files; these are stored in a single byte in each directory entry. These attributes are discussed in detail here. Note that it is one of these file attributes that indicates whether an entry in any directory represents a "real" file, or a subdirectory.
  • Last Change Date/Time: There is a space for each file to indicate the date and time that it was created or modified. You should know that these fields can be arbitrarily modified by any program to be whatever is wanted, so this date/time shouldn't be taken too seriously. I occasionally am asked if the date/time on a file can be used to prove when someone did something or not on their PC. It cannot, because it's too easy to change this information. Under normal circumstances the date/time stamp can be useful for telling when you last modified a file, for example, but you should not count on it to "prove" anything about when someone was last using their PC, for example.
  • File Size: The size of the file in bytes.
  • Link to Starting Cluster: The number of the cluster that starts the file (or subdirectory) is stored in the directory. This is what allows the operating system to find a file when it is needed, and how all the different files and directories are linked together on the disk. See here for more on cluster chaining.

Every regular directory on the disk has two special entries. These are named "." (single dot), which refers to the current directory, and ".." (double dot), which refers to the parent directory. These entries are used for navigation purposes; if you type "chdir .." then DOS will change your current directory to the parent of the one you were in. Note that the root directory has no parent directory, for obvious reasons. :^)

Next: Root Directory and Regular Directories


Home  -  Search  -  Topics  -  Up

The PC Guide (http://www.PCGuide.com)
Site Version: 2.2.0 - Version Date: April 17, 2001
© Copyright 1997-2004 Charles M. Kozierok. All Rights Reserved.

Not responsible for any loss resulting from the use of this site.
Please read the Site Guide before using this material.