COPY + Copying FilesCopies, renames, and concatenates (combines) files.
VERSION
PC-DOS 2.0+ (revised from 1.0)
MS-DOS equivalent: COPY (2.0+)
TYPE
Internal
SYNTAX
To copy files with the same or different names:
COPY [B] [sd:][spath]sfilename [B]
[td:][tpath]tfilename [B][/V]
To copy and combine files:
COPY [B] [sd:][spath]sfilename [B]
[+[cd:][cpath]cfilename [B] . . .]
[td:][tpath]tfilename [B][/V]
OPTIONS
/A or /B Indicates whether the
preceding file and all
subsequent files are to be
read as ASCII (text) or binary
files, and it is in effect
until further modified.
[sd:][spath]sfilename Specifies source file or files
to be copied.
(source)/A Causes the file to be treated
as a text SCII) file (read
only to the ^Z mark).
(source)/B Causes the entire file to be
copied based on the size
indicated in the directory (as
a binary file).
[td:][tpath]tfilename Specifies target file or files
to be copied to. The tFilename
is specified if you wish to
rename the target file during
copy.
(target)/A Adds a ^Z (end of file) as the
last character in an ASCII
file.
(target)/B Causes no ^Z to be added to
the end of a binary target
file.
+[cd:][cpath]cfilename Specifies file(s) to be
combined with source file
during copy.
/V Tells DOS to verify that the
target file is correct.
COPY is used to make copies from one disk to another, to
duplicate a file on the same disk, to read or write to or from
external devices, and to combine files.
EXAMPLES
COPY C:\TEST.FIL C:\DOS
copies TEST.FIL from the root directory to the subdirectory named
DOS (if this subdirectory exists).
COPY C:\TEST.FIL C:\DOS\NEW.FIL
copies TEST.FIL from the root directory into the subdirectory
DOS, naming the copy NEW.FIL.
COPY A:*.* B:
copies all the files from the current directory on the disk in
drive A to a disk in drive B, using their same file names.
COPY TEST.FIL COM1
sends the contents of TEST.FIL to COM1.
COPY CON: QUICK.FIL
sends whatever you type at the keyboard to a file named
QUICK.FIL. To end the file, press Ctrl-Z and Return.
COPY TEST.FIL + NEW.FIL TEST2.FIL
concatenates TEST.FIL and NEW.FIL into TEST2.FIL.
COPY TEST.FIL + NEW.FIL
concatenates TEST.FIL and NEW.FIL under the name TEST.FIL.
COPY TEST.FIL TEST2.FIL /V
makes another copy of TEST.FIL under the name TEST2.FIL, and
verifies that the copy is correct.
MESSAGES
Cannot do binary reads from a device
The /B option was used while attempting to copy from a system
device. Omit the /B and retry.
File cannot be copied onto itself
You tried to make a copy of a file on the same disk without
changing its name. Specify a new file name and retry.
File not found
The file does not exist or there is an error in the way its name
was typed.
Invalid path or name
The path or file name that was specified does not exist.
UNDO
Repeat the COPY command using correct drive/directory and/or
file name parameters. If you renamed the file during the copy, be
sure to use the new file name when repeating the COPY command.
Also, delete the unwanted copy.
NOTES
If a target file name is not specified, the source file name
is used. If there is more than one source file, as in a
concatenation, the name of the first source file is used.
Wildcards may be used. Device names may be used in place of file
names.
The /A and /B options are seldom used; when they are, it is
to distinguish between ASCII (text) and binary files that contain
special nontext characters, such as program files and database
files. When concatenating files, /A is the default; otherwise, /B
is the default.
------------------------------------------------------------------
[For related topics, press R]
SEE ALSO
ATTRIB Command
BACKUP Command
CHKDSK Command
DEL (DELETE) and ERASE Commands
DIR Command
DISKCOPY Command
ECHO batch file command
PRINT Command
RENAME EN) Command
REPLACE Command
TYPE Command
XCOPY Command
Questions: