NEXT UP previous
Next: Questions

Dos Files

A portable set of tools exist, called mtools, which allow various operating systems including Linux, to copy files and directories to and from standard DOS disks. This can be very useful for moving files to or from a DOS environment or for moving files between systems which otherwise do not share a common filesystem format. The main set of commands available in the mtools set are:

mcd dnamechange directory on DOS disk;
mcopy path dnamecopy files to DOS disk
mcopy dname pathcopy files from DOS disk;
mdel dnamedelete a DOS file;
mdir dnamedisplay a DOS directory;
mformat driveDOS format a low level formatted diskette;
mlabel drivechange DOS disk volume label;
mmd dnamemake a DOS disk directory;
mrd dnameremove a DOS disk directory;
mren dname dnamerename an existing file on DOS disk;
mtype dnamedisplay contents of DOS text file.

These commands are very similar to their DOS equivalents which have the same name but without the first letter m. In the table, path is any standard Linux file padiname, drive is a DOS disk drive letter followed by a colon and dname is a DOS disk file name. DOS file names are made up of a disk drive letter followed by a colon and then a pathname to a file or directory. The directory separator used in these pathnames can be either the Linux slash (/) character or the DOS backslash (\) character, though, if the backslash is used it will need to be quoted from the shell. To see the contents of the top level directory of a DOS disk:

	$ mdir a:
	Volume in drive A has no labal 
	Directory for A:/ 

	BOOK	<DIR>	4-13-95 1O:58a
	FDR	     70 4-13-95 11:00a
	FDW	     83 4-13-95 11:00a
	DOT 	<DIR>	6-05-95  6:00p
	LTI  DOC   5732 5-02-95  9:02a
            8 File(s) 828928 bytes free

or the contents of a subdirectory on the same disk:

	$ mdir a:/dot
	Volume in driva A has no label 
	Directory for A:/DOT

	.	<DIR> 	6-05-95 	6:O1p
	..	<DIR> 	6-05-95 	6:O1p
	D1O TGZ   65317 6-05-95 	6:02p
             3 File(s) 828928 bytes free

Having discovered a file of interest on the disk it is a simple matter to copy the file from the DOS disk into the current Linux directory, and verify that this has, indeed, taken place:

	$ mcopy a:/dot/dlO.tgz
	Copying D1O.TGZ
	$ ls -l
	-rw-r--r-- 1 pc book 65317 Jun 6 23:13 dlO.tgz 

All this is cheating a bit! In another tutorial I shall show you the preffered method of using both floppy disks and DOS filesystems, as well as a variety of other filesystems available for use with linux.

Please be patient though, at present this site is being updated on an almost daily basis!


NEXT UP previous
Next: Questions