Linux mcopy Command

Linux 命令大全Linux Command Encyclopedia

The Linux mcopy command is used to copy MSDOS format files to Linux, or to copy MSDOS files from Linux to a floppy disk.

mcopy can copy a single file to a specified file name, or copy multiple files to a specified directory. The source and destination files can be MSDOS or Linux files.

The mcopy command is an mtools tool command that can copy files within the DOS system or between the DOS and Linux operating systems.

Syntax

mcopy [-bnmpQt/][源文件][目标文件或目录]

Parameters:

  • b: Batch mode. This is an option optimized for copying a large number of files, but safety issues may arise when a crash occurs during the file copying process. /: Recursive copy. Includes the files contained in the directory and the files in all its subdirectories.
  • -n: When overwriting other files, overwrite directly without confirmation.
  • m: Set the source file's modification time as the destination file's modification time.
  • p: Set the source file's attributes as the destination file's attributes.
  • Q: When errors occur while copying multiple files, terminate the program as soon as possible.
  • t: Convert to a text file.
  • o: No warning message appears when overwriting MSDOS files.

Examples

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

mcopy a:autoexec.bat .

When the copied content 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, you can use the ls command to view the file structure in the Linux system after copying. 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:/ #以下为目录信息  
#文件名目录大小 修改时间  
./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 #统计总大小  
724 325 bytes free #剩余空间  
cmd@cmd-desktop:~$ mcopy -/ A:\* #将A盘上的所有文件复制到当前工作目录  
cmd@cmd-desktop:~$ls  
TEST AUTORUN.INF AUTORUN.BAT #A盘中的内容复制到Linux文件系统结构中 

Linux 命令大全Linux Command Encyclopedia

Other Extensions