8.3 filename


An 8.3 filename is a filename convention used by old versions of DOS and versions of Microsoft Windows prior to Windows 95 and Windows NT 3.5. It is also used in modern Microsoft operating systems as an alternate filename to the long filename for compatibility with legacy programs. The filename convention is limited by the FAT file system. Similar 8.3 file naming schemes have also existed on earlier CP/M, TRS-80, Atari, and some Data General and Digital Equipment Corporation minicomputer operating systems.

Overview

8.3 filenames are limited to at most eight characters, followed optionally by a filename extension consisting of a period and at most three further characters. For systems that only support 8.3 filenames, excess characters are ignored and if a file name has no extension, the, if present, has no significance. Furthermore, in these systems file and directory names are uppercase, although systems that use the 8.3 standard are usually case-insensitive. However, on non-8.3 Operating Systems accessing 8.3 File Systems the underlying system may alter filenames internally to preserve case and avoid truncating letters in the names, for example in the case of VFAT.

VFAT and Computer-generated 8.3 filenames

, a variant of FAT with an extended directory format, was introduced in Windows 95 and Windows NT 3.5. It allowed mixed-case Unicode long filenames in addition to classic 8.3 names by using multiple 32-byte directory entry records for long filenames.
To maintain backward-compatibility with legacy applications, on FAT and VFAT filesystems an 8.3 filename is automatically generated for every LFN, through which the file can still be renamed, deleted or opened, although the generated name may show little similarity to the original. On NTFS filesystems the generation of 8.3 filenames can be turned off. The 8.3 filename can be obtained using the Kernel32.dll function GetShortPathName.
Although there is no compulsory algorithm for creating the 8.3 name from an LFN, Windows uses the following convention:
  1. If the LFN is 8.3 uppercase, no LFN will be stored on disk at all.
  2. * Example:
  3. If the LFN is 8.3 mixed case, the LFN will store the mixed-case name, while the 8.3 name will be an uppercased version of it.
  4. * Example: becomes.
  5. If the filename contains characters not allowed in an 8.3 name or either part is too long, the name is stripped of invalid characters such as spaces and extra periods. If the name begins with periods the leading periods are removed. Other characters such as are changed to the underscore, and letters are put in uppercase. The stripped name is then truncated to the first 6 letters of its basename, followed by a tilde, followed by a single digit, followed by a period, followed by the first 3 characters of the extension.
  6. * Example: becomes . becomes. becomes
  7. On all NT versions including Windows 2000 and later, if at least 4 files or folders already exist with the same extension and first 6 characters in their short names, the stripped LFN is instead truncated to the first 2 letters of the basename, followed by 4 hexadecimal digits derived from an undocumented hash of the filename, followed by a tilde, followed by a single digit, followed by a period, followed by the first 3 characters of the extension.
  8. * Example: becomes.
  9. On Windows 95, 98 and ME, if more than 9 files or folders with the same extension and first 6 characters and in their short names, the name is further truncated to 5 letters, followed by a tilde, followed by two digits starting from 10, followed by a period and the first 3 characters of the extension.
  10. * Example: becomes if through all exist already.
NTFS, a file system used by the Windows NT family, supports LFNs natively, but 8.3 names are still available for legacy applications. This can optionally be disabled to improve performance in situations where large numbers of similarly named files exist in the same folder.
The ISO 9660 file system has similar limitations at the most basic Level 1, with the additional restriction that directory names cannot contain extensions and that some characters are not allowed in filenames. Level 2 allows filenames of up to 31 characters, more compatible with classic AmigaOS and classic Mac OS filenames.
During the 2001 Microsoft antitrust case, the names MICROS~1 and MICROS~2 were humorously used to refer to the companies that might exist after a proposed split of Microsoft.

Compatibility

This legacy technology is used in a wide range of products and devices, as a standard for interchanging information, such as compact flash cards used in cameras. VFAT LFN long filenames introduced by Windows 95/98/ME retained compatibility. But the VFAT LFN used on NT-based systems uses a modified 8.3 shortname.
If a filename contains only lowercase letters, or is a combination of a lowercase basename with an uppercase extension, or vice versa; and has no special characters, and fits within the 8.3 limits, a VFAT entry is not created on Windows NT and later versions such as XP. Instead, two bits in byte 0x0c of the directory entry are used to indicate that the filename should be considered as entirely or partially lowercase. Specifically, bit 4 means lowercase extension and bit 3 lowercase basename, which allows for combinations such as or but not. Few other operating systems support this. This creates a backward-compatibility filename mangling problem with older Windows versions that see all-uppercase filenames if this extension has been used, and therefore can change the capitalization of a file when it is transported, such as on a USB flash drive. This can cause problems for operating systems that do not exhibit the case-insensitive filename behavior as DOS and Windows do. Current versions of Linux will recognize this extension when reading; the mount option shortname determines whether this feature is used when writing.

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, 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:
This excludes the following ASCII characters:
The DOS filenames are in the OEM character set.
Code 0xE5 as the first byte makes troubles when extra-ASCII characters are used.
Directory entries, both in the Root Directory Region and in subdirectories, are of the following format:
Byte OffsetLengthDescription--
0x008DOS filename
The first byte can have the following special values:

Working with short filenames in a command prompt

Sometimes it may be desirable to convert a long filename to a short filename, for example when working with the command prompt. A few simple rules can be followed to attain the correct 8.3 filename.
  1. A SFN filename can have at most 8 characters before the dot. If it has more than that, the first 6 must be written, then a tilde as the seventh character and a number as the eighth. The number distinguishes it from other files with both the same first six letters and the same extension.
  2. Dots are important and must be used even for folder names. If there are multiple dots in the long file/directory name, only the last one is used. The preceding dots should be ignored. If there are more characters than three after the final dot, only the first three are used.
  3. Generally:
  4. *Any spaces in the filenames should be ignored when converting to SFN.
  5. *Ignore all periods except the last one. Do not include any other periods, just like the spaces. Use the last period if any, and the next characters. For instance, for.manifest,.man only would be used.
  6. * Commas, square brackets, semicolons, = signs and + signs are changed to underscores.
  7. * Case is not important, upper case and lower case characters are treated equally.
To find out for sure the SFN or 8.3 names of the files in a directory
use: shows the short names if there is one, and the long names.
or: shows only the short names, in the original DIR listing format.
In Windows NT-based operating systems, command prompt applets accept long filenames with wildcard characters ; long filenames with spaces in them need to be escaped.
Starting with Windows Vista, console commands and PowerShell applets perform limited pattern matching by allowing wildcards in filename and each subdirectory in the file path and silently substituting the first matching directory entry.
OWIKI.org. Text is available under the Creative Commons Attribution-ShareAlike License.