8.3 Filename - Directory Table

Directory Table

A directory table is a special type of file that represents a directory. Each file or directory stored within it is represented by a 32-byte entry in the table. Each entry records the name, extension, attributes (archive, directory, hidden, read-only, system and volume), the date and time of creation, the address of the first cluster of the file/directory's data and finally the size of the file/directory.

Legal characters for DOS filenames include the following:

  • Upper case letters AZ
  • Numbers 09
  • Space (though trailing spaces in either the base name or the extension are considered to be padding and not a part of the filename, also filenames with spaces in them could not be used on the DOS command line because it lacked a suitable escaping system)
  • ! # $ % & ' ( ) - @ ^ _ ` { } ~
  • Values 128–255

This excludes the following ASCII characters:

  • " * / : < > ? \ |
    Windows/MS-DOS has no shell escape character
  • Lower case letters az
    stored as AZ on FAT12/FAT16
  • Control characters 0–31
  • Value 127 (DEL)

Code 0xE5 as the first byte (see below) makes troubles when Cyrillic KOI8 encoding is used, because it corresponds to Cyrillic capital letter "Е". Some operating systems such as ANDOS used to automatically change the letter to the similar-looking Latin one.

The DOS filenames are in the OEM character set.

Directory entries, both in the Root Directory Region and in subdirectories, are of the following format:

Byte Offset Length Description
0x00 8 DOS filename (padded with spaces)

The first byte can have the following special values:

0x00 Entry is available and no subsequent entry is in use
0x05 Initial character is actually 0xE5
0x2E 'Dot' entry; either '.' or '..'
0xE5 Entry has been previously erased and is not available. File undelete utilities must replace this character with a regular character as part of the undeletion process.
0x08 3 DOS file extension (padded with spaces)
0x0b 1 File Attributes

The first byte can have the following special values:

Bit Mask Description
0 0x01 Read Only
1 0x02 Hidden
2 0x04 System
3 0x08 Volume Label
4 0x10 Subdirectory
5 0x20 Archive
6 0x40 Device (internal use only, never found on disk)
7 0x80 Unused

An attribute value of 0x0F is used to designate a long filename entry.

0x0c 1 Reserved; two bits are used by NT and later versions to encode case information
0x0d 1 Create time, fine resolution: 10ms units, values from 0 to 199.
0x0e 2 Create time. The hour, minute and second are encoded according to the following bitmap:
Bits Description
15-11 Hours (0-23)
10-5 Minutes (0-59)
4-0 Seconds/2 (0-29)

Note that the seconds is recorded only to a 2 second resolution. Finer resolution for file creation is found at offset 0x0d.

0x10 2 Create date. The year, month and day are encoded according to the following bitmap:
Bits Description
15-9 Year (0 = 1980, 127 = 2107)
8-5 Month (1 = January, 12 = December)
4-0 Day (1 - 31)
0x12 2 Last access date; see offset 0x10 for description.
0x14 2 EA-Index (used by OS/2 and NT) in FAT12 and FAT16, High 2 bytes of first cluster number in FAT32
0x16 2 Last modified time; see offset 0x0e for description.
0x18 2 Last modified date; see offset 0x10 for description.
0x1a 2 First cluster in FAT12 and FAT16. Low 2 bytes of first cluster in FAT32.
0x1c 4 File size

Read more about this topic:  8.3 Filename

Famous quotes containing the words directory and/or table:

    Although then a printer by trade, he listed himself in this early directory as an antiquarian. When he was asked the reason for this he replied that he always thought every town should have at least one antiquarian, and since none appeared for the post, he volunteered.
    —For the State of Iowa, U.S. public relief program (1935-1943)

    Many a time I have seen my mother leap up from the dinner table to engage the swarming flies with an improvised punkah, and heard her rejoice and give humble thanks simultaneously that Baltimore was not the sinkhole that Washington was.
    —H.L. (Henry Lewis)