Linux mcopy Command
The Linux mcopy command is used to copy MSDOS-format files into Linux, or to copy MSDOS files from Linux onto a disk.
mcopy can copy a single file to a specified filename, or copy several files into a specified directory. Source and destination files can be either MSDOS or Linux files.
The mcopy command is an mtools utility command that can copy files within DOS or between DOS and Linux operating systems.
Syntax
mcopy [-bnmpQt/][源文件][目标文件或目录]
Parameters:
- b Batch mode. This option is optimized for copying large numbers of files, but it poses security issues if a crash occurs during copying. / Recursive copying. Includes the files in a directory and all files in its subdirectories.
- -n Overwrite other files directly without asking for confirmation
- m Set the source file's modification time to that of the destination file.
- p Set the source file's attributes to those of the destination file.
- Q When an error occurs while copying multiple files, terminate the program as soon as possible.
- t Convert to a text file.
- o Do not display a 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 the content to be copied includes subdirectories and files, you must use the "-/" parameter for recursion, so the command is:
mcopy -/ A:\*
Before running this command, use the mdir command to view the original directory structure; after running mcopy, you can use the ls command to view the file structure in Linux after the copy. The result is as follows:
cmd@cmd-desktop:~$ mdir -/ a:\* #查看A 盘中的文件
Volume in drive A has no label #加载信息
Volume Serial Number is 13D2~055C
Directory for A:/ #以下为目录信息
#File name directory size modification time
./TEST 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 #统计总大小
724 325 bytes free #剩余空间
cmd@cmd-desktop:~$ mcopy -/ A:\* #将A盘上的所有文件复制到当前工作目录
cmd@cmd-desktop:~$ls
TEST AUTORUN.INF AUTORUN.BAT #A盘中的内容复制到Linux文件系统结构中
Linux Command Reference