mdir(1) mtools-3.9.1 (10Jun98) mdir(1)
Name
mdir - display an MSDOS directory
Note
This manpage has been automatically generated from mtools's
texinfo documentation. However, this process is only
approximative, and some items, such as crossreferences,
footnotes and indices are lost in this translation process.
Indeed, this items have no appropriate representation in the
manpage format. Moreover, only the items specific to each
command have been translated, and the general information
about mtools has been dropped in the manpage version. Thus
I strongly advise you to use the original texinfo doc.
* To generate a printable copy from the texinfo doc, run
the following commands:
./configure; make dvi; dvips mtools.dvi
* To generate a html copy, run:
./configure; make html
A premade html can be found at:
`http://www.tux.org/pub/knaff/mtools'
* To generate an info copy (browsable using emacs' info
mode), run:
./configure; make info
The texinfo doc looks most pretty when printed or as html.
Indeed, in the info version certain examples are difficult
to read due to the quoting conventions used in info.
Description
The mdir command is used to display an MS-DOS directory. Its
syntax is:
mdir [-/] [-f] [-w] [-a] [-X] msdosfile [ msdosfiles...]
Mdir displays the contents of MS-DOS directories, or the
entries for some MS-DOS files.
Mdir supports the following command line options:
Page 1 (printed 7/15/98)
mdir(1) mtools-3.9.1 (10Jun98) mdir(1)
/ Recursive output, just like Dos' -s option
w Wide output. With this option, mdir prints the
filenames across the page without displaying the file
size or creation date.
a Also list hidden files.
f Fast. Do not try to find out free space. On larger
disks, finding out the amount of free space takes up
some non trivial amount of time, as the whole FAT must
be read in and scanned. The -f flag bypasses this
step. This flag is not needed on FAT32 filesystems,
which store the size explicitely.
X Concise listing. List only a newline separated list of
pathnames without any decoration nor additional
information
An error occurs if a component of the path is not a
directory.
Description
Mdu is used to list the space occupied by a directory, its
subdirectories and its files. It is similar to the du
command on Unix. The unit used are clusters. Use the minfo
command to find out the cluster size.
mdu [-a] [ msdosfiles ... ]
a All files. List also the space occupied for individual
files.
s Only list the total space, don't give details for each
subdirectory.
Description
The mformat command is used to add an MS-DOS filesystem to a
low-level formatted diskette. Its syntax is:
mformat [-t cylinders] [-h heads] [-s sectors] [-l
volume_label] [-F] [-I fsVersion] [-S sizecode] [-2
sectors_on_track_0] [-M software_sector_size] [-a] [-X] [-C]
[-H hidden_sectors] [-r root_sectors] [-B boot_sector] [-0
rate_on_track_0] [-A rate_on_other_tracks] [-1] [-k] drive:
Mformat adds a minimal MS-DOS filesystem (boot sector, FAT,
and root directory) to a diskette that has already been
formatted by a Unix low-level format.
The following options are supported: (The S, 2, 1 and M
Page 2 (printed 7/15/98)
mdir(1) mtools-3.9.1 (10Jun98) mdir(1)
options may not exist if this copy of mtools has been
compiled without the USE_2M option)
Options
t The number of cylinders.
h The number of heads (sides).
s The number of sectors per track. If the 2m option is
given, number of 512-byte sector equivalents on generic
tracks (i.e. not head 0 track 0). If the 2m option is
not given, number of physical sectors per track (which
may be bigger than 512 bytes).
l An optional volume label.
S The sizecode. The size of the sector is 2 ^ (sizecode +
7).
2 2m format. The parameter to this option describes the
number of sectors on track 0, head 0. This option is
recommended for sectors bigger than normal.
1 don't use a 2m format, even if the current geometry of
the disk is a 2m geometry.
M software sector size. This parameter describes the
sector size in bytes used by the MS-DOS filesystem. By
default it is the physical sector size.
a If this option is given, an Atari style serial number
is generated. Ataris store their serial number in the
OEM label.
X formats the disk as an XDF disk. See section XDF for
more details. The disk has first to be low-level
formatted using the xdfcopy utility included in the
fdutils package.
C creates the disk image file to install the MS-DOS
filesystem on it. Obviously, this is useless on
physical devices such as floppies and hard disk
partitions.
H number of hidden sectors. This parameter is useful for
formatting hard disk partition, which are not aligned
on track boundaries (i.e. first head of first track
doesn't belong to the partition, but contains a
partition table). In that case the number of hidden
sectors is in general the number of sectors per
cylinder. This is untested.
Page 3 (printed 7/15/98)
mdir(1) mtools-3.9.1 (10Jun98) mdir(1)
n serial number
F Format the partition as FAT32 (experimental).
I Sets the fsVersion id when formatting a FAT32 drive.
In order to find this out, run minfo on an existing
FAT32 drive, and mail me about it, so I can include the
correct value in future versions of mtools.
c Sets the size of a cluster (in sectors). If this
cluster size would generate a FAT that too big for its
number of bits, mtools automatically increases the
cluster size, until the FAT is small enough.
r Sets the size of the root directory (in sectors). Only
applicable to 12 and 16 bit FATs.
B Use the bootsector stored in the given file or device,
instead of using its own. Only the geometry fields are
updated to match the target disks parameters.
k Keep the existing boot sector as much as possible.
Only the geometry fields are updated to match the
target disks parameters.
0 Data transfer rate on track 0
A Data transfer rate on tracks other than 0
To format a diskette at a density other than the default,
you must supply (at least) those command line parameters
that are different from the default.
Mformat returns 0 on success or 1 on failure.
It doesn't record bad block information to the Fat, use
mkmanifest for that.
Description
The mkmanifest command is used to create a shell script
(packing list) to restore Unix filenames. Its syntax is:
mkmanifest [ files ]
Mkmanifest creates a shell script that aids in the
restoration of Unix filenames that got clobbered by the MS-
DOS filename restrictions. MS-DOS filenames are restricted
to 8 character names, 3 character extensions, upper case
only, no device names, and no illegal characters.
The mkmanifest program is compatible with the methods used
in pcomm, arc, and mtools to change perfectly good Unix
Page 4 (printed 7/15/98)
mdir(1) mtools-3.9.1 (10Jun98) mdir(1)
filenames to fit the MS-DOS restrictions. This command is
only useful if the target system which will read the
diskette cannot handle vfat long names.
Example
You want to copy the following Unix files to a MS-DOS
diskette (using the mcopy command).
very_long_name
2.many.dots
illegal:
good.c
prn.dev
Capital
Mcopy converts the names to:
very_lon
2xmany.dot
illegalx
good.c
xprn.dev
capital
The command:
mkmanifest very_long_name 2.many.dots illegal: good.c prn.dev Capital >manifest
would produce the following:
mv very_lon very_long_name
mv 2xmany.dot 2.many.dots
mv illegalx illegal:
mv xprn.dev prn.dev
mv capital Capital
Notice that "good.c" did not require any conversion, so it
did not appear in the output.
Suppose I've copied these files from the diskette to another
Unix system, and I now want the files back to their original
names. If the file "manifest" (the output captured above)
was sent along with those files, it could be used to convert
the filenames.
Bugs
Page 5 (printed 7/15/98)
mdir(1) mtools-3.9.1 (10Jun98) mdir(1)
The short names generated by mkmanifest follow the old
convention (from mtools-2.0.7) and not the one from Windows
95 and mtools-3.0.
Description
The minfo command prints the parameters of a Dos filesystem,
such as number of sectors, heads and cylinders. It also
prints an mformat command line which can be used to create a
similar Dos filesystem on another media. However, this
doesn't work with 2m or Xdf media, and with Dos 1.0
filesystems minfo drive:
Mlabel supports the following option:
v Prints a hexdump of the bootsector, in addition to the
other information
Description
The mlabel command adds a volume label to a disk. Its syntax
is: mlabel [-vcs] drive:[new_label]
Mlabel displays the current volume label, if present. If
new_label is not given, and if neither the c nor the s
options are set, it prompts the user for a new volume label.
To delete an existing volume label, press return at the
prompt.
Reasonable care is taken to create a valid MS-DOS volume
label. If an invalid label is specified, mlabel changes the
label (and displays the new label if the verbose mode is
set). Mlabel returns 0 on success or 1 on failure.
Mlabel supports the following options:
c Clears an existing label, without prompting the user
s Shows the existing label, without prompting the user.
Description
The mmd command is used to make an MS-DOS subdirectory. Its
syntax is:
mmd [-voOsSrRA] msdosdirectory [ msdosdirectories... ]
Mmd makes a new directory on an MS-DOS filesystem. An error
occurs if the directory already exists.
Description
The mmount command is used to mount an MS-DOS disk. It is
only available on Linux, as it is only useful if the OS
Page 6 (printed 7/15/98)
mdir(1) mtools-3.9.1 (10Jun98) mdir(1)
kernel allows to configure the disk geometry. Its syntax is:
mmount msdosdrive [mountargs]
Mmount reads the boot sector of an MS-DOS disk, configures
the drive geometry, and finally mounts it passing mountargs
to mount. If no mount arguments are specified, the name of
the device is used. If the disk is write protected, it is
automatically mounted read only.
Description
The mmove command is used to moves or renames an existing
MS-DOS file or subdirectory. mmove [-voOsSrRA] sourcefile
targetfile mmove [-voOsSrRA] sourcefile [ sourcefiles... ]
targetdirectory
Mmove moves or renames an existing MS-DOS file or
subdirectory. Unlike the MS-DOS version of MOVE, mmove is
able to move subdirectories. Files or directories can only
be moved within one filesystem. Data cannot be moved from
Dos to Unix or vice-versa. If you omit the drive letter
from the target file or directory, the same letter as for
the source is assumed. If you omit the drive letter from
all parameters, drive a: is assumed by default.
Description
The mpartition command is used to create MS-DOS filesystems
as partitions. This is intended to be used on non-Linux
systems, i.e. systems where fdisk and easy access to Scsi
devices are not available. This command only works on
drives whose partition variable is set.
mpartition -p drive mpartition -r drive mpartition -I drive
mpartition -a drive mpartition -d drive mpartition -c [-s
sectors] [-h heads] [-t cylinders] [-v [-T type] [-b begin]
[-l length] [-f]
Mpartition supports the following operations:
p Prints a command line to recreate the partition for the
drive. Nothing is printed if the partition for the
drive is not defined, or an inconsistency has been
detected. If verbose (-v) is also set, prints the
current partition table.
r Removes the partition described by drive.
I Initializes the partition table, and removes all
partitions.
c Creates the partition described by drive.
Page 7 (printed 7/15/98)
mdir(1) mtools-3.9.1 (10Jun98) mdir(1)
a "Activates" the partition, i.e. makes it bootable.
Only one partition can be bootable at a time.
d "Desactivates" the partition, i.e. makes it unbootable.
If no operation is given, the current settings are printed.
For partition creations, the following options are
available:
s sectors
The number of sectors per track of the partition (which
is also the number of sectors per track for the whole
drive).
h heads
The number of heads of the partition (which is also the
number of heads for the whole drive). By default, the
geometry information (number of sectors and heads) is
figured out from neighbouring partition table entries,
or guessed from the size.
t cylinders
The number of cylinders of the partition (not the
number of cylinders of the whole drive.
b begin
The starting offset of the partition, expressed in
sectors. If begin is not given, mpartition lets the
partition begin at the start of the disk (partition
number 1), or immediately after the end of the previous
partition.
l length
The size (length) of the partition, expressed in
sectors. If end is not given, mpartition figures out
the size from the number of sectors, heads and
cylinders. If these are not given either, it gives the
partition the biggest possible size, considering disk
size and start of the next partition.
The following option is available for all operation which
modify the partition table:
f Usually, before writing back any changes to the
partition, mpartition performs certain consistenct
checks, such as checking for overlaps and proper
alignment of the partitions. If any of these checks
fails, the partition table is not changes. The -f
allows you to override these safeguards.
The following option is available for all operations:
Page 8 (printed 7/15/98)
mdir(1) mtools-3.9.1 (10Jun98) mdir(1)
v Together with -p prints the partition table as it is
now (no change operation), or as it is after it is
modified.
vv If the verbosity flag is given twice, mpartition will
print out a hexdump of the partition table when reading
it from and writing it to the device.
Description
The mrd command is used to remove an MS-DOS subdirectory.
Its syntax is:
mrd [-v] msdosdirectory [ msdosdirectories... ]
Mrd removes a directory from an MS-DOS filesystem. An error
occurs if the directory does not exist or is not empty.
Description
The mren command is used to rename or move an existing MS-
DOS file or subdirectory. Its syntax is:
mren [-voOsSrRA] sourcefile targetfile
Mren renames an existing file on an MS-DOS filesystem.
In verbose mode, Mren displays the new filename if the name
supplied is invalid.
If the first syntax is used (only one sourcefile), and if
the target name doesn't contain any slashes or colons, the
file (or subdirectory) is renamed in the same directory,
instead of being moved to the current mcd directory as would
be the case with mmove. Unlike the MS-DOS version of REN,
mren can be used to rename directories.
Description
The mshowfat command is used to display the FAT entries for
a file. Syntax:
$ mshowfat files
Description
The mtoolstest command is used to tests the mtools
configuration files. To invoke it, just type mtoolstest
without any arguments. Mtoolstest reads the mtools
configuration files, and prints the cumulative configuration
to stdout. The output can be used as a configuration file
itself (although you might want to remove redundant
clauses). You may use this program to convert old-style
Page 9 (printed 7/15/98)
mdir(1) mtools-3.9.1 (10Jun98) mdir(1)
configuration files into new style configuration files.
Description
The mtype command is used to display contents of an MS-DOS
file. Its syntax is:
mtype [-ts] msdosfile [ msdosfiles... ]
Mtype displays the specified MS-DOS file on the screen.
In addition to the standard options, Mtype allows the
following command line options:
t Text file viewing. Mtype translates incoming carriage
return/line feeds to line feeds.
s Mtype strips the high bit from the data.
The mcd command may be used to establish the device and the
current working directory (relative to MS-DOS), otherwise
the default is A:/.
Mtype returns 0 on success, 1 on utter failure, or 2 on
partial failure.
Unlike the MS-DOS version of TYPE, mtype allows multiple
arguments.
Description
The mzip command is used to issue ZIP disk specific commands
on Solaris or HPUX. Its syntax is:
mzip [-epqrwx]
Mzip allows the following command line options:
e Ejects the disk.
f Force eject even if the disk is mounted (must be given
in addition to -e).
r Write protect the disk.
w Remove write protection.
p Password write protect.
x Password protect
u Temporarily unprotect the disk until it is ejected.
Page 10 (printed 7/15/98)
mdir(1) mtools-3.9.1 (10Jun98) mdir(1)
The disk becomes writable, and reverts back to its old
state when ejected.
q Queries the status
To remove the password, set it to one of the passwordless
modes -r or -w: mzip will then ask you for the password, and
unlock the disk. If you have forgotten the password, you
can get rid of it by low-level formatting the disk (using
your SCSI adaptor's BIOS setup).
The ZipTools disk shipped with the drive is also password
protected. On Dos or on a Mac, this password is
automatically removed once the ZipTools have been installed.
From various articles posted to Usenet, I learned that the
password for the tools disk is APlaceForYourStuff. Mzip
knows about this password, and tries it first, before
prompting you for a password. Thus mzip -w z: unlocks the
tools disk. The tools disk is formatted in a special way so
as to be usable both in a PC and in a Mac. On a PC, the Mac
filesystem appears as a hidden file named `partishn.mac'.
You may erase it to reclaim the 50 Megs of space taken up by
the Mac filesystem.
Description
The xcopy script is used to recursively copy one directory
to another. Its syntax is:
xcopy sourcedirectory targetdirectory
If targetdirectory does not exist, it is created. If it
does exist, the files of sourcedirectory are directly copied
into it, and no subdirectory called sourcedirectory is
created, unlike with cp -rf.
Bugs
This command is a big kludge. A proper implementation would
take a rework of significant parts of mtools, but
unfortunately I don't have the time for this right now. The
main downside of this implementation is that it is
inefficient on some architectures (several successive calls
to mtools, which defeats mtools' caching).
See Also
Mtools' texinfo doc
Page 11 (printed 7/15/98)