mcopy
Copy files to/from MS-DOS filesystems
SYNOPSIS
mcopy [options] sourcefile [sourcefile...] targetfile
mcopy [options] sourcefile [sourcefile...] targetdirectory
mcopy [options] -i image_file sourcefile [sourcefile...] targetfile
PARAMETERS
-t
Perform text file transfer, converting Unix line endings (LF) to DOS line endings (CR/LF) when copying to DOS, and vice-versa when copying from DOS.
-b
Perform binary file transfer, disabling any line ending conversions.
-p
Preserve original file attributes, including time, date, and read-only status.
-v
Enable verbose mode, showing each file copied and other informational messages.
-s
Copy subdirectories recursively, similar to cp -r on Unix.
-a
Ask for confirmation before overwriting an existing file.
-n
Never overwrite existing files; files with the same name will be skipped.
-D
Overwrite destination file only if the source file is newer.
-C
Create target directories on the destination if they do not already exist.
-i image_file
Operate on the specified disk image file instead of a physical device. This is useful for working with virtual disk images.
DESCRIPTION
mcopy is a utility from the mtools package, designed to copy files between MS-DOS filesystems and Unix filesystems. It provides direct, non-mounting access to DOS-formatted media, such as floppy disks, USB drives, or disk images. This makes it convenient for quick transfers or interacting with media that might be problematic to mount directly. mcopy supports various DOS file attributes, wildcards, and handles path conversions between DOS and Unix conventions. It's particularly useful for environments requiring interoperability with older DOS systems or specific embedded devices that use FAT filesystems.
CAVEATS
mcopy is part of the mtools package, which primarily supports FAT (FAT12, FAT16, FAT32) filesystems. It does not support NTFS, ext4, or other modern Unix filesystems. Drive letters (e.g., a:, c:) used by mcopy are mapped to Unix devices or disk images via the mtools configuration files (e.g., ~/.mtoolsrc or /etc/mtools/mtools.conf).
Long filename (LFN) support depends on the mtools version and configuration; older versions might only support 8.3 filenames.
DOS PATH SYNTAX
mcopy uses DOS-style drive letters (e.g., a: for floppy, c: for hard disk) and can interpret both forward slashes (/) and backslashes (\) as path separators. Absolute paths within a DOS drive often use a double colon, such as c::\path\filename.ext.
CONFIGURATION
The behavior of mcopy and other mtools commands can be customized through configuration files like ~/.mtoolsrc (user-specific) or /etc/mtools/mtools.conf (system-wide). These files define drive mappings, default transfer modes (text/binary), and other operational parameters.
HISTORY
The mtools package, including mcopy, was originally developed by Emmet P. M. F. C. M. F. P. Emmet and has been maintained and expanded upon, primarily by Alain Knaff. It emerged as a crucial set of utilities for Linux users in the early days, providing a robust and safer alternative to direct mounting of potentially unreliable or untrusted DOS-formatted media. Its development has focused on maintaining compatibility with various FAT filesystem nuances and improving user convenience.