mcopy Command in Linux

The mcopy command can be used to copy files between Unix and MS-DOS format partitions. The mtools package provides the mcopy command. The mtools package can help you when working with the DOS or Windows operating system while running Linux, and facilitate the transfer of information and manipulation of removable media for those operating systems.

Syntax:

# mcopy [options] sourcefile target

mcopy Command Options

Options Description
-t Convert Unix line breaks to MS-DOS line breaks and vice versa when copying text files.
-b Operate in batch mode; use for large copies of data.
-s Copy recursively.
-P Preserve attributes of copied files.
-Q If one copy fails, stop copying the rest. Useful if you think you may run out of disk space.
-a Assume that all incoming files are ASCII and convert carriage return/line feed to plain line feed.
-T Convert line breaks as with -a, but also convert PC-8 characters to ISO-8859-1 characters. Replace untranslatable characters with # or . for Unix and DOS respectively.
-n Do not ask for confirmation when overwriting Unix files. Use -o to turn off confirmation for overwriting DOS files.
-m Preserve file modification time.
-v Display the names of files as they are copied.
-D clash-option Specify the action to take if the specified directory name already exists. See mmd for the possible clash options.

mcopy Command Examples

1. To copy a file from a floppy disk to the current directory, run this command:

mcopy a:file .

2. Copying files from the local system to the disk is similar:

mcopy file a:

3. Copy autoexec.bat in the root directory of Disk A to the current working directory:

# mcopy a:autoexec.bat

4. When the copied content includes subdirectories and files, the parameter “-/” must be used for recursive operation:

# mcopy -/ A:\* 
Related Post