Content-type: text/html
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 available: Changes DOS file attribute options Changes or reports the DOS working directory Copies DOS files to and from a UNIX operating system Deletes a DOS file Displays contents of a DOS directory Adds a DOS file system to a low-level formatted diskette Creates a shell script to restore UNIX file names from DOS mtools utility to label a DOS volume Makes a DOS directory Removes a DOS directory Performs a low level read (copy) of a DOS file to UNIX Renames an existing DOS file Displays the contents of a DOS file Performs a low level write (copy) of a UNIX file to DOS
DOS file names are optionally composed of a drive letter followed by a colon, a subdirectory, and a file name. Subdirectory names can use either the '/' or '\' separator. The use of the '\' 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-style 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 commands may have to change UNIX names to fit the DOS file name conventions. Most commands provide the verbose option (-v), that displays new file names if they have been changed. The following table shows some examples of file name conversions:
UNIX name | DOS name | Reason for the change |
thisisatest | THISISAT | file name too long |
file.stuff | FILE.STU | extension too long |
prn.txt | XRN.TXT | PRN is a device name |
.abc | X.ABC | null file name |
hot+cold | HOTXCOLD | illegal character |
All options use the minus (-) option, not the slash (/) as provided under DOS conventions.
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/fddrive, therefore, a symbolic link between the floppy device
and
/dev/fddrive
is also required.
If the proper device is not specified (when multiple disks capacities
are supported), an error message from the device driver may be displayed.
This message can be ignored.
If the diskette is a SCSI attached floppy drive designated device rz13, the following example sets up a floppy diskette for access by the mtools commands: # cd /dev # ./MAKEDEV rz13
Commands: ln(1), mattrib(1), mcd(1), mcopy(1), mdel(1), mdir(1), mformat(1), mlabel(1), mmd(1), mrd(1), mread(1), mren(1), mtype(1), mwrite(1)
Floppy disk interface: fd(7)
Utilities: MAKEDEV(8), mknod(8)