mattrib - change MSDOS file attribute flags mbadblocks - tests a floppy disk, and marks the bad blocks in the FAT mcd - change MSDOS directory mcopy - copy MSDOS files to/from Unix mdel - delete an MSDOS file mdir - display an MSDOS directory mformat - add an MSDOS filesystem to a low-level formatted floppy disk mlabel - make an MSDOS volume label mmd - make an MSDOS subdirectory mmount - mount an MSDOS disk mrd - remove an MSDOS subdirectory mmove - move or rename an MSDOS file or subdirectory mren - rename an existing MSDOS file mtype - display contents of an MSDOS file mtest - tests and displays the configuration
MSDOS filenames are optionally composed of a drive letter followed by a colon, a subdirectory, and a filename. Filenames without a drive letter refer to Unix files. Subdirectory names can use either the '/' or '\' separator. The use of the '\' separator or wildcards will require the names to be enclosed in quotes to protect them from the shell. (Note: Wildcards in Unix filenames should not be enclosed in quotes, because here we want the shell to expand them)
All options use the '-' (minus) flag, not '/' as you'd expect in MSDOS.
Most mtools commands allow multiple filename parameters, which doesn't follow MSDOS conventions, but which is more user-friendly.
Unix name | MSDOS name | Reason for the change |
thisisatest | THISISAT | filename too long |
alain.knaff | ALAIN.KNA | extension too long |
prn.txt | XRN.TXT | PRN is a device name |
.abc | X.ABC | null filename |
hot+cold | HOTXCOLD | illegal character |
The initial Unix-style filename (whether long or short) is also
called
primary
name, and the derived short name is also called
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.
When a name clash happens, mtools asks you what it should do. It offers several choices:
To chose an option type its first letter at the prompt. If you use a lower case letter, the option only applies for this file only, if you use an upper case letter, the option applies to all files.
You may also chose options (for all files) on the command line, when invoking mtools:
By default, the user is prompted if the primary name clashes, and the secondary name is autorenamed.
If a name clash occurs in a Unix directory, mtools only asks whether to overwrite the file, or to skip it.
The VFAT filesystem is able to remember the case of the filenames. However, filenames which differ only in case are not allowed to coexist in the same directory. For example if you store a file called LongFileName on a VFAT filesystem, mdir will show this file as LongFileName, and not as Longfilename. However, if you then try to add LongFilename to the same directory, it will be refused, because case is ignored for clash checks.
The VFAT filesystem allows to store the case of a filename in the attribute byte, if all letters of the filename are the same case, and if all letters of the extension are the same case too. Mtools uses this information when displaying the files, and also to generate the Unix when mcopying to a Unix directory. This may have unexpected results when applied to files written using an pre-7.0 version of DOS: Indeed, these filenames map to all upper case. This is different from the behavior of the old version of mtools which used to generate lower case Unix filenames.
Caution / Attention distributors: If mtools is compiled on Linux a kernel more recent than 1.3.34, it won't run on an older kernel. However, if has been compiled on an older kernel, it still runs on a newer kernel, except that Xdf access is slower. It is recommended that distribution authors only include mtools binaries compiled on kernels older than 1.3.34 until 2.0 comes out. When 2.0 will be out, mtools binaries compiled on newer kernels may (and should) be distributed. Mtools binaries compiled on kernels older than 1.3.34 won't run on any 2.1 kernel or later.
The fat checking code chokes on 1.72 Mb disks mformatted with pre-2.0.7 mtools. Set the environmental variable MTOOLS_FAT_COMPATIBILITY to bypass the fat checking.
The support for non-Linux OS variants has not been tested for a long time. It may contain bugs, or even not work at all.