FAT directory entry
Previous Topic  Next Topic 

Home


A FAT file system has two basic types of directory, the root directory and subdirectories.  On FAT12 and FAT16, the root directory is in a fixed location, just after the FAT, and it is a fixed size.  On FAT32, the start of the root directory is defined in the BPB, and the directory can be any length.


A directory is made up of 0x20 byte records.  The only difference between a root and subdirectory, is that the sub directory always starts with two records showing the current location, and the parent directory location. These entries are ".     " and "..      ".  The file attribute for both is 0x10 showing it is a subdirectory.  Typically, the first entry for a root directory is the volume label, with a file attribute of 0x08




Root directory


000000   50 4F 57 45 52 53 48 4F - 54 20 20 08 00 00 00 00    POWERSHOT     

000010   00 00 00 00 00 00 C7 09 - 49 37 00 00 00 00 00 00          Ç I7     

000020   E5 4D 47 5F 31 36 39 36 - 4A 50 47 20 00 1B 8B 86    åMG_1696JPG  ‹†

000030   49 37 4C 37 00 00 4A B5 - 46 37 02 00 74 82 2C 00    I7L7  JµF7 t‚,

000040   E5 4D 47 5F 31 36 32 36 - 4A 50 47 20 00 89 8D 86    åMG_1626JPG  ‰†

000050   49 37 49 37 00 00 0B 01 - 43 37 44 16 18 C7 43 00    I7I7   C7DÇC

000060   E5 54 4C 41 4E 54 41 20 - 4A 50 47 20 18 2E 6B 97    åTLANTA JPG .k

000070   49 37 4D 37 00 00 05 0E - 3E 35 28 38 75 11 04 00    I7M7  >5(8u

000080   E5 45 41 43 48 20 20 20 - 4A 50 47 20 18 70 6B 97    åEACH   JPG pk

000090   49 37 4A 37 00 00 F4 08 - 43 35 31 3A F3 FC 01 00    I7J7  ôC51:óü

0000A0   E5 45 41 43 48 5F 32 20 - 4A 50 47 20 18 90 6B 97    åEACH_2 JPG k

0000B0   49 37 49 37 00 00 D7 6A - 44 35 30 3B 0B 26 03 00    I7I7  ×jD50; &

0000C0   E5 45 41 43 48 4E 43 20 - 4A 50 47 20 18 0A 6C 97    åEACHNC JPG  l

0000D0   49 37 49 37 00 00 94 91 - 4C 35 C4 3C C6 33 03 00    I7I7  ”‘L5Ä<Æ3

0000E0   E5 4D 47 5F 31 37 37 39 - 4A 50 47 20 00 2E 09 98    åMG_1779JPG  . ˜

0000F0   49 37 4C 37 00 00 D7 72 - 49 37 5E 3E 64 B2 4D 00    I7L7  ×rI7^>d²M

000100   E5 4D 47 5F 31 37 38 37 - 4A 50 47 20 00 97 0D 98    åMG_1787JPG  ˜

000110   49 37 4C 37 00 00 84 75 - 49 37 38 65 D8 FC 36 00    I7L7  „uI78eØü6

000120   E5 4D 47 5F 31 37 37 38 - 4A 50 47 20 00 A2 10 98    åMG_1778JPG  ¢˜

000130   49 37 4A 37 00 00 D5 72 - 49 37 B7 80 3A 3A 41 00    I7J7  ÕrI7·€::A

000140   E5 4D 47 5F 32 33 38 30 - 4A 50 47 20 00 3F 4E A4    åMG_2380JPG  ?N¤

000150   49 37 4A 37 00 00 14 9A - 30 35 44 16 DD AF 22 00    I7J7  š05Dݯ"

000160   E5 4D 47 5F 32 33 37 39 - 4A 50 47 20 00 21 51 A4    åMG_2379JPG  !Q¤

000170   49 37 4C 37 00 00 12 9A - 30 35 9C 27 96 42 1F 00    I7L7  š05œ'B

000180   E5 4D 47 5F 32 33 39 34 - 4A 50 47 20 00 05 87 A4    åMG_2394JPG  ‡¤

000190   49 37 4C 37 00 00 15 7D - 38 35 55 A1 30 F6 35 00    I7L7  }85U¡0ö5

0001A0   E5 4D 47 5F 31 38 33 31 - 4A 50 47 20 00 1C CA A4    åMG_1831JPG  ʤ

0001B0   49 37 4C 37 00 00 14 51 - CD 34 51 BC 7F D3 31 00    I7L7  QÍ4Q¼Ó1

0001C0   E5 4D 47 5F 31 38 32 34 - 4A 50 47 20 00 09 CD A4    åMG_1824JPG   ͤ

0001D0   49 37 4A 37 00 00 56 70 - CC 34 3B D5 CE 04 16 00    I7J7  VpÌ4;ÕÎ

0001E0   E5 4D 47 5F 31 38 32 39 - 4A 50 47 20 00 46 CE A4    åMG_1829JPG  FΤ

0001F0   49 37 4C 37 00 00 D3 4E - CD 34 3E E0 94 5F 25 00    I7L7  ÓNÍ4>à_%



Subdirectory


000000   2E 20 20 20 20 20 20 20 - 20 20 20 10 00 47 22 4D    .           G"M

000010   03 39 03 39 00 00 23 4D - 03 39 1D 53 00 00 00 00    99  #M9S   

000020   2E 2E 20 20 20 20 20 20 - 20 20 20 10 00 47 22 4D    ..          G"M

000030   03 39 03 39 00 00 23 4D - 03 39 00 00 00 00 00 00    99  #M9     

000040   41 55 54 4F 45 58 45 43 - 42 41 54 20 00 4C 22 4D    AUTOEXECBAT  L"M

000050   03 39 03 39 00 00 94 73 - 27 1F 1E 53 E0 02 00 00    99  s'Sà 

000060   41 55 54 4F 45 58 45 43 - 44 43 53 20 00 51 22 4D    AUTOEXECDCS  Q"M

000070   03 39 03 39 00 00 45 7B - E3 1E 20 53 C1 02 00 00    99  E{ã SÁ 

000080   41 58 20 20 20 20 20 20 - 42 41 54 20 00 57 22 4D    AX      BAT  W"M

000090   03 39 03 39 00 00 36 79 - 39 1C 22 53 57 00 00 00    99  6y9"SW  

0000A0   42 20 20 20 20 20 20 20 - 42 41 54 20 00 5C 22 4D    B       BAT  \"M

0000B0   03 39 03 39 00 00 25 61 - 6A 24 23 53 4C 00 00 00    99  %aj$#SL  

0000C0   42 41 43 4B 53 45 57 20 - 42 41 54 20 00 62 22 4D    BACKSEW BAT  b"M

0000D0   03 39 03 39 00 00 E8 51 - 8F 38 24 53 8A 01 00 00    99  èQ8$SŠ 

0000E0   42 4B 20 20 20 20 20 20 - 42 41 54 20 00 67 22 4D    BK      BAT  g"M

0000F0   03 39 03 39 00 00 73 6C - 82 25 25 53 37 02 00 00    99  sl‚%%S7 

000100   42 55 49 4C 44 41 4C 4C - 42 41 54 20 00 6B 22 4D    BUILDALLBAT  k"M

000110   03 39 03 39 00 00 AE 7A - 8F 32 27 53 C8 0F 00 00    99  ®z2'SÈ 

000120   43 43 35 20 20 20 20 20 - 42 41 54 20 00 72 22 4D    CC5     BAT  r"M

000130   03 39 03 39 00 00 48 8D - FA 38 2F 53 E8 00 00 00    99  Hú8/Sè  

000140   43 43 38 36 20 20 20 20 - 42 41 54 20 00 78 22 4D    CC86    BAT  x"M

000150   03 39 03 39 00 00 BA 94 - 89 28 30 53 1D 02 00 00    99  º‰(0S 

000160   43 43 53 43 35 20 20 20 - 42 41 54 20 00 7D 22 4D    CCSC5   BAT  }"M

000170   03 39 03 39 00 00 09 71 - 8A 1E 32 53 36 00 00 00    99   qŠ2S6  

000180   43 43 5A 35 20 20 20 20 - 42 41 54 20 00 83 22 4D    CCZ5    BAT  ƒ"M

000190   03 39 03 39 00 00 A0 5A - 5C 25 33 53 5A 00 00 00    99   Z\%3SZ  

0001A0   43 46 44 4C 4C 20 20 20 - 42 41 54 20 00 86 22 4D    CFDLL   BAT  †"M

0001B0   03 39 03 39 00 00 69 B5 - CA 24 34 53 0A 01 00 00    99  iµÊ$4S  

0001C0   43 46 4F 52 4D 41 54 20 - 42 41 54 20 00 8E 22 4D    CFORMAT BAT  Ž"M

0001D0   03 39 03 39 00 00 7C 72 - 98 19 35 53 E1 01 00 00    99  |r˜5Sá 

0001E0   43 4F 4D 50 49 4C 45 20 - 42 41 54 20 00 92 22 4D    COMPILE BAT  "M

0001F0   03 39 03 39 00 00 23 07 - A6 1A 36 53 DD 00 00 00    99  #¦6SÝ  



Each 0x20 byte entry used to be a file on early DOS versions, but now the structure has been enhanced (see later) to allow for names longer than 8.3.  However, it is fully compatible and the first character in the entry can have two control values.  If it is set to 0xE5 then the entry is a deleted file.  If it is set to 0x00, then this is the ned of the directory file.  Any other value is the first character of the file name.


The two sectors above all have short 8.3 file names, all upper case.


The record structure is as follows


Bytes 0x00-0x0A        File name as 8 characters then thre characters extension.  The '.' is automatically added


Byte 0x0B                File attribute