Long filename
From Wikipedia, the free encyclopedia
Long filename (LFN) is the name given to the longer and therefore more descriptive file names on the FAT filesystem, which were previously restricted to eight characters and a three-character extension (referred to as a DOS 8.3 filename ). The first Microsoft Windows OS to implement long filenames on FAT was Windows NT 3.5 in 1994.
The long filename system allows a maximum length of 255[1] 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.[2]
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 File Allocation Table article.
Contents |
[edit] Compatibility issues
The way Microsoft added support for LFNs to the FAT filesystem was by adding hidden directory entries, of "volume label" type, to the filesystem to store the longer names. The reason they chose to do this was compatibility: volume labels are generally ignored by programs and operating systems. Programs running on older operating systems could still access the files while newer operating systems could offer a longname API to programs.
When LFNs were first introduced into a MS-DOS based operating system with Windows 95 the implementation caused some problems when people used older programs. 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 locked out in this mode.
Also if booting into plain DOS the long filenames would not be visible. At the same time Microsoft decided not to update many of the older programs to support LFNs. Of those, one that particularly stands out is the program File Manager, the Windows for Workgroups 3.11 File Manager (which has been made obsolete by the new operating system shell, the Explorer). Under Windows NT 3.51 and Windows NT 4.0 File Manager supports LFNs, however the Windows 95 version of File Manager came from Windows for Workgroup 3.11.
OS/2 had its own method of supporting LFNs on FAT driver, incompatible with Microsoft's. They were stored as a .LONGNAME extended attribute, were mostly just "labels", only visible in tools designed to display them, and most annoyingly not available for accessing files by pathname at the API level. However this can be rectified with a driver.
[edit] Limitations
Because 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.[3] The Windows implementation does not allow two files with the same name, even with different cases, such as “Example” and “EXAMple”. It will name the file in the way it is first referred to, and after that any form will match that one file.
A true upper-and-lowercase long filename system, such as Linux filesystems, allows many different files with the same name but different cases, such as “Example”, “EXample”, and “exAMPle”, and treats them as totally separate. Any reference to a file by name must be an exact match. If such files are moved into a Windows FAT filesystem, conflicts will arise.
[edit] LFN drivers
The following is a list of drivers that can be used to provide support for long file names used in Windows 95:
OS | Driver Name | Provider |
---|---|---|
OS/2 | VFAT OS2 | 3rd party |
DOS | DOSLFN | 3rd party |
DR-DOS | LFNDOS | Provided |
[edit] Similar implementations
Prior to the release of Windows NT, one of the first file systems to support long name and spaces was the Macintosh File System for the original version of Mac OS on the Macintosh 128K released in January 1984. However although the Macintosh File System supported file names up to 255 characters in length, the Finder at the time only allowed up to 63 characters and with the release of the Hierarchical File System in September 1985 the maximum file name length allowed by the file system was reduced to 31 characters[1]. With the re-write of the Finder for System 7 the maximum file name length was dropped to 31, matching the maximum allowed by the file system[1]. In January 1998 Apple released Mac OS 8.1 with the HFS Plus file system which included support for 255 character file names, however this was still limited by the Finder to 31 characters[2].
[edit] References
- ^ a b Apple Computer (July 15, 1992). Technical Note FL515: File Manager File Handling Q&As. Apple Developer Connection. Apple Computer. Retrieved on 2006-12-20.
- ^ Apple Computer (January 30, 1998). Technical Note TN1121: Mac OS 8.1. Apple Developer Connection. Apple Computer. Retrieved on 2006-12-20.