TITLE
    How Windows NT Generates MS-DOS Compatible Filenames
Article ID:
Created:
Modified:
57360
1/6/98
3/18/98

TOPIC

    Windows NT generates 8.3 aliases from Long Filenames by using the following algorithm

    This information was provided by Claris Corporation on 16 March 1998, and incorporated into Apple Computer's Tech Info Library.


DISCUSSION

    Windows NT file system (NTFS) filenames do not have the same limitations that MS-DOS FAT style filenames have. MS-DOS style filenames are limited to eight and three character strings separated by a period. NTFS filenames can be much longer and may contain more types of characters. When Windows NT copies a file from an NTFS partition to a FAT partition, it needs to change the filename for compatibility. The following rules are applied when filenames are converted from NTFS to FAT:

    * All disallowed characters (spaces, restricted punctuation, Unicode characters) in the NTFS filename are removed.
    * All periods except the last one preceding a character are removed.
    * The first three characters following the last period are used for the three-letter extension of the FAT filename.
    * All characters that are illegal in FAT but legal in NTFS are replaced with underscore characters ("_").
    * The first six characters of the NTFS filename, a tilde character (~), and a single digit are used for the eight letter prefix of the FAT filename.


    For the first four files with similar names:
    If necessary, truncate the filename to the first six characters in the name and the first three characters in the extension.
    Add the suffix ~<number> to the remaining six-character file name.

    For Example, Let's say you had a filename called "MYTESTFILE.TXT". This would get truncated to "MYTEST~1.TXT".
    If you had several files that were similar in name the results would be as follows"

    LFN DOS Name
    MYTESTFILE.TXT MYTEST~1.TXT
    MYTESTFILE1.TXT MYTEST~2.TXT
    MYTESTFILE2.TXT MYTEST~3.TXT
    MYTESTFILE3.TXT MYTEST~4.TXT

    For successive files:
    If necessary, truncate the filename to the first two characters in the name and the first three characters in the extension.
    Use a hashing algorithm to generate the next four characters
    Append ~1 to the remaining six-character file name
    If that fails to generate a unique name, append ~2, and so forth.

    LFN DOS Name
    MYTESTFILE4.TXT MYDDDA~1.TXT
    MYTESTFILE5.TXT MYEDDE~1.TXT

    MYTESTFILE6.TXT MYDDDE~1.TXT
    MYTESTFILE7.TXT MYEEDA~1.TXT
    MYTESTFILE8.TXT MYDDEA~1.TXT

    Because the process can generate filenames that are difficult to interpret, it is good practice to keep the unique portion of the filename in the first six characters whenever possible

    If this does not result in a unique filename, only the first five characters of the NTFS filename are used, followed by the tilde and two digits.

    When filenames are moved from a FAT partition to an NTFS partition, no conversion takes place because NTFS fully supports the FAT file naming convention.


Document Information
Product Area: Apple Software
Category: Claris Software
Sub Category: General Topics; Other Applications
Keywords: kclaris

Copyright © 2000 Apple Computer, Inc. All rights reserved.