1.4.1 Directory Entries

Directory entries can be either files, directories, or under more modern DOS systems, long file name fragments (see Long File Names). Each entry that is a file or directory contains the following data:

File Name

MS DOS names files in two parts, the file name, and the extension. The accepted convention is to separate these fields with the "." character, however in a directory entry, there is no such character. One must note that in a directory entry, the extension field immediately follows the file name field. For example, if you created a file named MYREPORT.DOC, it would look like MYREPORTDOC in the raw directory.

Attributes

File attributes are stored in an 8 bit field of the directory entry, with each bit representing a flag. Out of the eight possible flags, only six are widely used by DOS systems.

Attributes of a file can be viewed within a DOS environment using the attrib command. It is also one of the only ways to list hidden files.

Read-Only

Files with read-only attribute set can not be written to by normal DOS systems.

Hidden

The hidden flag hides files from normal viewing. This is common among system files.

System

When a system file has the system attribute set, normal directory operations will skip over it, making it harder to accidentally ruin your system.

Volume

The volume attribute is used to indicate that a directory entry is the label for the volume in which it resides. The volume label is only allowed to exist in the root directory.

Sub Directory

An entry must have the sub directory attribute set in its directory entry in order to be treated as a directory. It also makes the file unable to be opened by conventional means. Operating systems usually provided special interfaces for opening directories.

Archive

The archive flag is used by backup programs to tell whether a file should be backed up. In most cases, when a backup program backs up a file, it turns off this flag, and when the file gets modified the flag gets turned back on to indicate that it has changed and needs backing up.

Time and Date of Creation

The creation time and date field keeps track of the when the file was created, or last modified.

Starting Cluster

The starting cluster field marks where the data for the given entry actually resides by indicating the first cluster in a cluster chain (see File Allocation Tables, for information about cluster chains).

File Size

The file size field tells how much data is in the given file (in bytes). For entries that are sub directories, this field is 0. Directories have no need for file size as they are terminated by a null entry or the end of a cluster chain.