PDA

View Full Version : Filename Convention


Hans Schoeni
February 21st 06, 04:29 PM
Hi,
Is there a description (ISO-Norm or similar) which describe the
filename convention for filenames in WinXP ? Which special characters
(.,:;-&% ...) are allowed, which not ?

Thanks for tips

Hans from Switzerland

Wesley Vogel
February 21st 06, 07:33 PM
MS has screwed up the link that I had for this, so here's the whole thing...

File Names in Windows XP Professional
Link is no longer good.
http://www.microsoft.com/resources/documentation/Windows/XP/all/reskit/en-us/Default.asp?url=/resources/documentation/windows/xp/all/reskit/en-us/prkc_fil_rbrx.asp

File names in Windows XP Professional can be up to 255 characters and can
contain spaces, multiple periods, and special characters that are not
allowed in MS-DOS file names. Windows XP Professional makes it possible for
other operating systems to access files that have long names by generating
an MS-DOS-readable (8.3) name for each file. These MS-DOS-readable names
also enable MS-DOS-based and Windows 3.x–based applications to recognize and
load files that have long file names. When a program saves a file on a
computer running Windows XP Professional, both the 8.3 file name and long
file name are retained.

Note
• The 8.3 format means that files can have between 1 and 8 characters in the
file name. The name must start with a letter or a number and can contain
any characters except the following:

. " / \ [ ] : ; | = , * ? (space)

• An 8.3 file name typically has a file name extension that is from one to
three characters long and has the same character restrictions. A period
separates the file name from the file name extension.

• Several special file names are reserved by the system and cannot be used
for files or folders:

CON, AUX, COM1, COM2, COM3, COM4, LPT1, LPT2, LPT3, PRN, NUL

To see both the long and short file names for each file in the folder, at
the command line, type:

dir /x

Long File Names at the Command Prompt
At the command prompt, if you type the long name of a file or folder that
contains spaces, you must enclose the name in quotation marks. For example,
if you have a program called Dump Disk Files that you want to run from the
command prompt and you enter the name without quotation marks, it generates
the error message "Cannot find the program Dump or one of its components."

You must also use quotation marks around each referenced set of long file
names when a path typed at the command line includes spaces, as in the
following example:

move "c:\This month's reports\*.*" "c:\Last month's reports"

Caution
Use wildcard characters such as the asterisk (*) and question mark (?)
carefully in conjunction with the del and copy commands. Windows XP
Professional searches both long and short file names for matches to the
wildcard character combination you specify, which can cause additional files
to be deleted or copied. It is always a good idea to run the dir command
first on the specified files to make sure you are affecting only the files
you intend to use.

Generating Short File Names
In Windows XP Professional, both FAT and NTFS use the Unicode character set,
which contains several prohibited characters that MS-DOS cannot read, for
their names. To generate a short MS-DOS-readable file name, Windows XP
Professional deletes all of these characters from the long file name and
removes any spaces. Because an MS-DOS-readable file name can have only one
period, Windows XP Professional also removes extra periods from the file
name. If necessary, Windows XP Professional truncates the file name to six
characters and appends a tilde (~) and a number. For example, each
non-duplicate file name is appended with ~1. Duplicate file names end with
~2, then ~3, and so on. After the file names are truncated, the file name
extensions are truncated to three or fewer characters. Finally, when
displaying file names at the command line, Windows XP Professional
translates all characters in the file name and extension to uppercase.

Note
• You can permit extended characters by using the fsutil behavior set
command. You must restart the computer before this setting takes effect.
For more information about using the fsutil behavior set command, see
Windows XP Professional Help.

When five or more files exist that can result in duplicate short file names,
Windows XP Professional uses a slightly different method for creating short
file names. For the fifth and subsequent files, Windows XP Professional:

• Uses only the first two letters of the long file name.

• Generates the next four letters of the short file name by mathematically
manipulating the remaining letters of the long file name.

• Appends ~1 (or another number, if necessary, to avoid a duplicate file
name) to the result.

This method substantially improves performance when Windows XP Professional
must create short file names for a large number of files with similar long
file names. Windows XP Professional uses this method to create short names
for files on both FAT and NTFS volumes.

Table 13.15 shows the short file names for files created by six tests.

Table 13.15 Short File Names Created by Windows XP Professional — Example
One
Long File Name Short File Name
This is test 1.txt THISIS~1.TXT
This is test 2.txt THISIS~2.TXT
This is test 3.txt THISIS~3.TXT
This is test 4.txt THISIS~4.TXT
This is test 5.txt THA1CA~1.TXT
This is test 6.txt THA1CE~1.TXT

If the long file names in Table 13.5 are created in a different order, their
short file names are different, as shown in Table 13.16.

Table 13.16 Short File Names Created by Windows XP Professional — Example
Two
Long File Name Short File Name
This is test 2.txt THISIS~1.TXT
This is test 3.txt THISIS~2.TXT
This is test 1.txt THISIS~3.TXT
This is test 4.txt THISIS~4.TXT
This is test 5.txt THA1CA~1.TXT
This is test 6.txt THA1CE~1.TXT

When you delete a file, its short file name is also deleted. When you
create new files in the same folder, Windows XP Professional might re-use
short file names that have been deleted. For instance, in Example 1, if you
delete the file "This is test 1.txt," and then create a new file called
"This is test 7.txt," its short file name becomes THISIS~1.TXT.

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In ,
Hans Schoeni > hunted and pecked:
> Hi,
> Is there a description (ISO-Norm or similar) which describe the
> filename convention for filenames in WinXP ? Which special characters
> (.,:;-&% ...) are allowed, which not ?
>
> Thanks for tips
>
> Hans from Switzerland

Google