Linux mcopy Command
The Linux mcopy command is used to copy MSDOS format files to Linux or to copy MSDOS files from Linux to a disk.
mcopy can copy a single file to a specified filename or multiple files to a specified directory. Both source and destination files can be MSDOS or Linux files.
The mcopy command is a mtools tool command that can copy files in a DOS system or between DOS and Linux operating systems.
Syntax
mcopy [-bnmpQt/][source file][destination file or directory]
Parameters:
- b Batch mode. This option is optimized for copying a large number of files, but it can cause security issues if a crash occurs during file copying.
- / Recursive copy. Includes files in directories and all subdirectories.
- -n Overwrite other files without confirmation.
- m Set the modification time of the source file to that of the destination file.
- p Set the attributes of the source file to those of the destination file.
- Q End the program quickly when errors occur during multiple file copying.
- t Convert to a text file.
- o No warning message when overwriting MSDOS files.
Example
Copy autoexec.bat from the root directory of drive A to the current working directory:
mcopy a:autoexec.bat .
When copying includes subdirectories and files, the "-/" parameter must be used for recursive operation, so the command is:
mcopy -/ A:\*
Before executing this command, use the mdir command to view the original directory structure. After executing mcopy, use the ls command to view the file structure in the Linux system, as follows:
cmd@cmd-desktop:~$ mdir -/ a:\* # View files in drive A
Volume in drive A has no label # Mount information
Volume Serial Number is 13D2~055C
Directory for A:/ # Directory information
# Filename directory size modification time
./TEST <DIR> 2009-09-23 16:59
AUTORUN.INF 265 2009-09-23 16:53
AUTORUN.BAT 43 2009-09-23 16:56
3 files 308 bytes # Total size
724 325 bytes free # Free space
cmd@cmd-desktop:~$ mcopy -/ A:\* # Copy all files from drive A to the current working directory
cmd@cmd-desktop:~$ ls
TEST AUTORUN.INF AUTORUN.BAT # Contents of drive A copied to the Linux file system structure