" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#008000" VLINK="004000" ALINK="#00C000">
COPY COMMAND
Purpose: Copies one or more files to a specified disk.
Syntax: COPY [/A|/B] [/P[ROMPT]] [/V] [/Q[UIET]]
source
target
source ::= FILELIST
target ::= FILELIST
Type: Internal command
Parameters:
/A - copied file is considered to be a text file (ASCII), data is copied
up to the end of file (Ctrl-Z), the remaining part of the file isn't
copied.
/B - file is copied according to the length, specified in the directory.
/V - Switches on the file verification mode during writing into the file.
/Q - Switches off messages during copying.
/P - Asks for user's permission for file copying.
FILELIST ::= [parms]
{
[d:][path]file_name[.ext] |
(FILELIST[,|+| ]...) |
@reference_file
}
FILELIST - defines the files to be copied.
file_name - may contain wild card symbols ( '?' and '*' ).
reference_file - is the name of a text file containing the command's
options. It should be specified explicitly.
parms - are any combination of the control parameters for
FILELIST or DIRLIST (see INTERNAL DOS COMMAND ARGUMENTS
for detailed description).
The COPY command may be used in three ways:
- for copying without changing file names;
- for copying with changing the file names;
- for copying and merging files.
Copying without changing of a file name
Syntax: COPY [/V] [/A|/B] [d:][path\]file_name[.ext] [d:][path]
This command is used for creating files, that have identical names,
types, and contents.
Examples:
1. A> COPY C:\COMMAND.COM
copies COMMAND.COM from the root directory of C: disk to the current one,
while
2. A> COPY C:\COMMAND.COM A:\
copies COMMAND.COM file to the root directory of A: disk.
Note: If the target directory doesn't exist, the COPY command considers the
second parameter to be the destination file name.
Copying with changing a file name
Used to make a copy of a file, that has a different name than that of
the source.
Syntax: COPY [/V] [/A|/B] [d:][path\]file_name.ext [d:][path]file_name.ext
Examples:
1. A> COPY FILE1.TXT B:REPORT.DOC
copies the file FILE1.TXT from the current directory of the A: disk into
the current directory of B: disk and names it REPORT.DOC.
It is allowed to use standard devices names while copying, e.g.:
A> COPY CON FILE1.TXT
A> COPY CON AUX
A> COPY CON LPT1
A> COPY AUX CON
A> COPY FILE1.TXT LPT1
The NUL device may also be used.
2. The following example shows how you can use the COPY command, to fill the
file with data straight from the keyboard.
A> COPY CON FILE1.TXT
The command instructs the system to copy the all the data input from
the keyboard to the file FILE1.TXT until the [Ctrl-Z] has been pressed.
The input may also be completed by consecutively pressing [F6] and [Enter].
Note: It is assumed in the above example, that the [F6] key has not been
redefined.
Copying and merging of files
Syntax: COPY [d:][path\]filename.ext
[+[d:][path\]filename.ext...]
[d:][path\]filename.ext
Used for merging files while copying. Files specified by the command
are appended to the end of the first copied file. The time and the date of
the merged file will be written into the directory, where files are copied
to. The message displayed at the end of the COPY command's work, states the
number of created output files.
Files merging requires a list of two or more initial files, separated
by a sign '+'.
Examples:
1. A> COPY FILE1.TXT + FILE2.TXT + B:FILE3.TXT BIGFILE.TXT
This command creates the file BIGFILE.TXT in the current directory. This
file contains files FILE1.TXT, FILE2.TXT from the current directory and the
file FILE3.TXT from the current directory of the disk B:, one after another.
If the name of the target file is not specified, extra files are added
to the first one of the list. The command
2. A> COPY FILE1.TXT + FILE2.TXT
appends the FILE2.TXT file to the FILE1.TXT.
The wild cards '*' and '?' can be used in names of merged files as well as
in the name of the target file.
3. A> COPY *.H + *.C PROGRAM.PRN
This command merges all the files with the .H extension, then all the files
with the .C extension and writes them into the PROGRAM.PRN file.
4. A> COPY *.H + *.C *.PRN
merges every file with the .H extension with a corresponding file with the
.C extension and creates files with .PRN extension bearing the same name.
I.e., the FILE1.H file is merged with the FILE1.C file thus forming the
FILE1.PRN file.