mtools - Provides a collection of tools for manipulating DOS files
The mtools commands are a public domain collection of programs that let you
read, write, and manipulate files on a DOS file system (typically a
diskette) from a UNIX system. Each command attempts to emulate the DOS
equivalent command as closely as possible. The following commands are
Converts a DOS file format to an UNIX file format.
Changes DOS file attribute options such as whether the file is write-
able. This is analogous the the chmod command in UNIX.
Changes or reports the DOS working directory
Copies DOS files to and from a UNIX operating system
Deletes a DOS file
Displays the contents of a DOS directory
Copies a diskette to another diskette as a bit-image copy
Adds a DOS file system to a low-level formatted diskette
Creates a shell script to restore UNIX file names from DOS file names
Labels a DOS volume
Makes a DOS directory
Removes a DOS directory
Performs a low level read (copy) of a DOS file to a UNIX-format file
Renames an existing DOS file
Displays the contents of a DOS file
Performs a low level write (copy) of a UNIX file to a DOS-format file
Converts a UNIX file to DOS format
DOS file names optionally are composed of a drive letter followed by a
colon, a subdirectory, and a file name. Subdirectory names can use either
the slash (/) or backslash (\) characters as a separator. The use of the
backslash separator or wildcards requires the names to be enclosed in
quotes to protect them from the shell.
The regular expression "pattern matching" routines follow the UNIX rules.
For example, an asterisk (*) matches all DOS files in place of asterisks
separated by a dot (.) such as *.*. The archive, hidden, read-only, and
system attribute bits are ignored during pattern matching.
Not all UNIX file names are supported in the DOS world. The mtools com-
mands might have to change UNIX file names to fit the DOS file name conven-
tions. Most commands provide the verbose option (-v), that displays new
file names if they have been changed. The following table shows some exam-
ples of file name conversions:
UNIX File Name DOS File Name Reason for the Change
thisisatest THISISAT File name too long
file.stuff FILE.STU File xtension too long
The string prn specifies a
.abc X.ABC Null file name
hot+cold HOTXCOLD Illegal character
All options use the minus (-) option, not the slash (/) as provided under
The mcd command is used to establish the device and the current working
directory (relative to the DOS file system), otherwise the default is
assumed to be A:\.
All the mtools commands return 0 on success and 1 on complete failure.
All mtools require a floppy diskette properly installed on the system. All
mtools facilities address a device named /dev/disk/floppy. You must create
a symbolic link between the diskette's device special files and the file
/dev/disk/floppy, depending on what type of diskette drive is on your sys-
tem. See the EXAMPLES section for information on how you set up the
If the proper device is not specified (when multiple disk capacities are
supported) the device driver might display an error message. You can ignore
Device special file names are created automatically for all existing dev-
ices. If no device special file exists for the floppy drive, see dsfmgr(8).
Refer to hwmgr(8) for information on how you determine what kind of floppy
drive is on your system, and to find its device name.
1. If the diskette drive is attached to the floppy disk interface (FDI)
it has the device name floppyN, where N is an integer. Your /dev/disk
directory must contain the following device special files for two
floppy disk partitions:
Link the c partition to the file /dev/disk/floppy:
# ln -s /dev/disk/floppy0c /dev/disk/floppy
2. If the diskette drive is a SCSI device, the device name has the format
dskN, where N is an integer. Use the SysMan Station, or the hwmgr com-
mand to determine the device name.
The following example sets up a SCSI floppy diskette for access by the
mtools commands by linking the device to /dev/disk/floppy as follows:
# ln -s /dev/disk/dsk13c /dev/disk/floppy
3. To test the configuration of a diskette drive, insert a DOS formatted
disk and enter the following command:
Volume in drive A is "volume_name."
Directory for A:/
file type size date time
file type size date time
Commands: dos2unix(1) ,dsfmgr(8), hwmgr(8), ln(1), mattrib(1), mcd(1),
mcopy(1), mdel(1), mdir(1), mdiskcopy(1), mformat(1), mlabel(1), mmd(1),
mrd(1), mread(1), mren(1), mtype(1), mwrite(1), sysman_station(8),
Floppy disk interface: fd(7)