Long filenames (LFN), are Microsoft's way of implementing filenames longer than the 8.3 filename, or short-filename, naming scheme used in Microsoft DOS in their modern FAT and NTFS filesystems. Because these filenames can be longer than an 8.3 filename, they can be more descriptive. Another advantage of this scheme is that it allows longer extensions common on other operating systems (e.g. .jpeg, .tiff, .html, and .xhtml) rather than specialized shortened names (e.g. .jpg, .tif, .htm, .xht). The first Microsoft Windows operating system to implement long filenames on FAT was Windows NT 3.5 in 1994.
The long filename system allows a maximum length of 255 UTF-16 characters, including spaces and non-alphanumeric characters (excluding the following characters, which have special meaning within the command interpreter or the operating system kernel: \ / : * ? " < > |). This is achieved by chaining up to 20 directory entries of 13 2-byte unicode characters each.
To maintain compatibility with older operating systems, Microsoft formulated a method of generating an 8.3 filename from the long filename (for example, "Microsoft.txt" to "MICROS~1.TXT") and associating it with the file.
For technical details of the implementation, please refer to the Design of the FAT file system article.
Microsoft implemented support for LFNs in the FAT filesystem by using hidden directory entries—of the volume label type—to store the longer names. This so-called VFAT scheme was chosen for compatibility; volume labels are generally ignored by programs and operating system components. Programs running on older operating systems could still access the files' short names, while newer, LFN-aware operating systems and programs could use the longer ones.
When LFNs were first introduced into an MS-DOS-based operating system with Windows 95, they caused some problems for older programs. For example, a DOS program performing sector-level directory operations while Windows was in DOS mode could destroy long filename information so, by default, sector-level access to hard disks was disallowed in this mode.
Upon booting into plain DOS the long filenames would not be visible unless a VFAT LFN driver had been installed (see below). Microsoft did not add LFN support to many of its older programs, including File Manager, the Windows for Workgroups file manager that was made obsolete by the new operating system shell, Explorer. Windows NT supported LFNs on NTFS file systems beginning with the release of NT 3.1, and all of its utilities, including File Manager, were updated to support LFNs. NT 3.5 added FAT LFN support in preparation for Windows 95. However, the Windows 95 version of File Manager came from Windows for Workgroups 3.11.
OS/2 stored LFNs for FAT filesystems in .LONGNAME extended attributes that were incompatible with Microsoft's implementation and only visible to tools supporting the new standard. Many APIs providing access to files by pathname could not see the new, longer names, although this shortcoming could be rectified by installing a driver.
Because the FAT LFN implementation is layered on top of an older, more limited naming system, there are inevitable complications, such as if an attempt is made to create too many files with the same first six letters. In addition, one is more likely to encounter issues creating files or folders in the root directory, since FAT12 and FAT16 only allocate space for 512 root directory entries on hard disks. Since long filenames use more than one directory entry, this problem may occur with fewer than 512 files or folders in the root directory. In fact there is space only for 25 long filenames of maximum length (512/20). This problem does not exist for FAT32 volumes.
The maximum length of file name will be reduced if it's in a folder or deep hierarchy of folders under the root folder of any drive. For example, a file named "
ABCDEFGHIJ" inside absolute folder location "
C:\1234567890\1234567890" (Total of 21 characters excluding "
C:\") can be renamed to a maximum of 234 characters.
VFAT LFN drivers
The following is a list of drivers that can be used to provide support for VFAT long file names as used in Windows 95:
|any DOS||DOSLFN, LFNDOS||third-party|
Previous file systems
Before LFN support was implemented into the FAT family of file systems, various file managers provided their own methods to attach and maintain longer file descriptions.
Among the first to do so were the alternative command line processors 4DOS and NDOS with their internal
DESCRIBE command and corresponding
DESCRIPT.ION files, optional hidden files located in each directory storing a line-based list of file names located in the directory together with their textual description and optional data entries (for example, extended attributes and configuration data for other programs). The descriptions can be up to 511 characters long and are displayed along the file names in much the same way as long file names are listed alongside their short filename aliases in
DIR listings. If an entry exists for a file, it will be copied and moved with the file for as long as these command line processors are used to perform the operation. This scheme is still maintained by successors such as 4OS2, 4NT, and Take Command, and it has been adopted also by various other programs.
Prior to the release of OS/2 and Windows NT, one of the first file systems to support long names and spaces was the Macintosh File System, written for the original version of Mac OS on the Macintosh 128K released in January 1984. Although the Macintosh File System supported file names up to 255 characters in length, at the time Finder only allowed up to 63 characters. With the release of the Hierarchical File System (HFS) in September 1985, the maximum file name length allowed by the file system was reduced to 31 characters. When the Finder was re-written for System 7, the maximum file name length was dropped to 31, matching the maximum allowed by the file system. In January 1998, Apple released Mac OS 8.1 with HFS Plus, which included support for 255 character file names; however, Finder continued to limit names to 31 characters until Mac OS X.
AmigaOS in 1985 allowed up to 30 characters in a filename.
- 255-character mixed-case long filename is possible only for files and/or folders with no sub-folders at the root folder of any drive.
- Making Room for Long Filenames
- Long Filename Specification
- CocoaDev: MSDOSFileSystem
- Errors Creating Files or Folders in the Root Directory
- Apple Computer (July 15, 1992). "Technical Note FL515: File Manager File Handling Q&As". Apple Developer Connection. Apple Computer. Retrieved 2006-12-20.
- Apple Computer (January 30, 1998). "Technical Note TN1121: Mac OS 8.1". Apple Developer Connection. Apple Computer. Retrieved 2006-12-20.
- Novell (February 11, 1999). "TID1002030 Windows NT, Long File Names on Netware".