Glossary

Concept - Filename Namespace

Previous Next

Overview

Old versions of the FAT filesystem had strict limits on filenames. Many characters were forbidden, and the length was restricted to 11 characters (a small namespace). Newer versions of FAT allowed more characters and longer filenames. NTFS has almost no restrictions.

Filenames are given a flag to show which namespace the name belongs to. In order to support old applications, NTFS allocates a short DOS-friendly name to any file with an DOS-incompatible name.

Possible Namespaces

0: POSIX
This is the largest namespace. It is case sensitive and allows all Unicode characters except for NULL (0) and Forward Slash '/'. The maximum name length is 255 characters. N.B. There are some characters, e.g. Colon ':', which are valid in NTFS, but Windows will not allow you to use.
1: Win32
Win32 is a subset of the POSIX namespace and is case insensitive. It uses all the Unicode characters, except: '"' '*' '/' ':' '<' '>' '?' '\' '|' N.B. Names cannot end with Dot '.', or Space ' '.
2: DOS
DOS is a subset of the Win32 namespace, allowing only 8 bit upper case characters, greater than Space ' ', and excluding: '"' '*' '+' ',' '/' ':' ';' '<' '=' '>' '?' '\'. N.B. Names must match the following pattern: 1 to 8 characters, then '.', then 1 to 3 characters.
3: Win32 & DOS
This namespace means that both the Win32 and the DOS filenames are identical and hence have been saved in this single filename record.

To convert a POSIX or Win32 filename to a DOS-friendly filename, follow these steps:

  1. Remove all Unicode characters
  2. Remove all '.' but the last one if it is not the first character
  3. Uppercase all letters
  4. Remove forbidden characters
  5. Truncate everything before the potential '.' to 6 characters, and add the string "~1"
  6. Truncate everything after the potential '.' to 3 characters
  7. While the name already exists, increment the string "~1"

N.B. Step 7 means that although the generated DOS name is unique, it is impossible to deduce it from the Win32 name only.


Copyright (C) Validate HTML Validate CSS SourceForge