mtools: long names
2.4 VFAT-style long file names
==============================
This version of mtools supports VFAT style long filenames. If a Unix
filename is too long to fit in a short DOS name, it is stored as a VFAT
long name, and a companion short name is generated. This short name is
what you see when you examine the disk with a pre-7.0 version of DOS.
The following table shows some examples of short names:
Long name MS-DOS name Reason for the change
--------- ---------- ---------------------
thisisatest THISIS~1 filename too long
alain.knaff ALAIN~1.KNA extension too long
prn.txt PRN~1.TXT PRN is a device name
.abc ABC~1 null filename
hot+cold HOT_CO~1 illegal character
As you see, the following transformations happen to derive a short
name:
* Illegal characters are replaced by underscores. The illegal
characters are `;+=[]',\"*\\<>/?:|'.
* Extra dots, which cannot be interpreted as a main name/extension
separator are removed
* A `~'N number is generated,
* The name is shortened so as to fit in the 8+3 limitation
The initial Unix-style file name (whether long or short) is also
called the "primary" name, and the derived short name is also called the
"secondary" name.
Example:
mcopy /etc/motd a:Reallylongname
Mtools creates a VFAT entry for Reallylongname, and uses REALLYLO as
a short name. Reallylongname is the primary name, and REALLYLO is the
secondary name.
mcopy /etc/motd a:motd
Motd fits into the DOS filename limits. Mtools doesn't need to
derivate another name. Motd is the primary name, and there is no
secondary name.
In a nutshell: The primary name is the long name, if one exists, or
the short name if there is no long name.
Although VFAT is much more flexible than FAT, there are still names
that are not acceptable, even in VFAT. There are still some illegal
characters left (`\"*\\<>/?:|'), and device names are still reserved.
Unix name Long name Reason for the change
--------- ---------- ---------------------
prn prn-1 PRN is a device name
ab:c ab_c-1 illegal character
As you see, the following transformations happen if a long name is
illegal:
* Illegal characters are replaces by underscores,
* A `-'N number is generated,