COPY (MSX-DOS)
This page was last modified 12:37, 1 June 2020 by Gdx. Based on work by Mars2000you.

Contents

Effect

Copies data from files or devices to other files or devices.

Only under MSX-DOS 1, it can also merge (concatenate) several source files into an unique destination file. If you are under MSX-DOS 2 / Nextor, this operation can only be made with CONCAT.

Syntaxes

Under MSX-DOS 1

  • COPY /A /B <SourceDevice>:<SourceFilename> + <SourceDevice>:<SourceFilename>... <DestinationDevice>:<DestinationFilename>

Important Note: the <DestinationFilename> parameter is exclusive to the MSX-DOS 1 version of COPY - if you are under MSX-DOS 2 / Nextor, you need to use CONCAT to achieve a merging operation or use a new filename.

  • COPY /A /B <SourceDevice>:<Filename> <DestinationDevice>

This syntax is used when only the <DestinationDevice> must not be followed by the : character.

  • COPY /A /B <SourceDevice> <DestinationDevice>

This syntax is used when both <SourceDevice> and <DestinationDevice> must not be followed by the : character.

  • COPY /A /B <SourceDevice> <Filename>

This syntax is used for example to send all you type on the keyboard in a file (after pressing CTRL+Z).

Under MSX-DOS 2 / Nextor

  • COPY /S /H /P /A /B /V /T <SourceDevice>:\<Path>\<SourceFilename> + <SourceFilename>... <DestinationDevice>:\<Path>\
  • COPY /S /H /P /A /B /V /T <SourceDevice>:<Filename> <DestinationDevice>

This syntax is used when only the <DestinationDevice> must not be followed by the : character.

  • COPY /S /H /P /A /B /V /T <SourceDevice> <DestinationDevice>

This syntax is used when both <SourceDevice> and <DestinationDevice> must not be followed by the : character.

  • COPY /S /H /P /A /B /V /T <SourceDevice> <Filename>

This syntax is used for example to send all you type on the keyboard in a file (after pressing CTRL+Z).

Notes:

  • Character backslash (\) serves as a separator between the folders and the file name in MSX-DOS2. You don't have to put it after the colon of the device name. Backslash is replaced by the character yen (¥) on Japanese MSX or the character won (₩) on Korean MSX.
  • Character slash (/) serves to declare an option. You can put the options after the command or behind all other parameters.
  • If this command gives a 'Not enough memory' error then probably reducing the number of buffers (see the BUFFERS command) or removing some environment variables (see the SET command) will free up sufficient memory.

Parameters

<SourceDevice> and <DestinationDevice> are the names for the devices used as source and destination. They can be disk drives, specified by a letter followed by the : character, but also devices whose names are not followed by the : character (for example, an RS-232 serial device if you use AUX).

If you don't specify the source or destination device, the computer will use the currently active drive as source or destination (by default, it's drive A:)

Device type Device name Remark
Disk drive A, B, C, D, E, F, G, H A floppy disk interface can control until 2 drives.
Auxiliary device AUX
Console CON
Printer LST
BIt heaven NUL
Printer PRN


<Path> is used to specify the location in folders of file to be used in the copying operation. Each folder name in path are separate by a backslash (\). This parameter is only available under MSX-DOS 2 / Nextor and makes possible to copy all the files of the current active directory (in this case, the <SourceFileName> parameter is not used).

<SourceFilename> is the file name to be used as source in the copying operation. Wildcards can replace some characters in filename to get several files. The asterisk (*) and question mark (?) are used as wildcard characters. The asterisk matches any sequence of characters, whereas the question mark matches any single character.

<DestinationFilename> can only be used under MSX-DOS 1 as file name to be used as destination, especially in a merging (concatening) operation or simply because you need to use another file name. When a destination file name is not specified, the first mentioned source file name will be used as destination file name. If you are under MSX-DOS 2 / Nextor, you need to use CONCAT to make these operations.

File names are in the format 8 characters followed by a point and an extension with 3 characters. The destination file name under MSX-DOS 1 can't already be used for another file on the disk inserted in the specified disk drive.

/S is used to accept system files in the copying operation. This parameter is available only since COMMAND2.COM 2.40.

/H is used to accept hidden files in the copying operation. This parameter is only available under MSX-DOS 2 / Nextor.

/P is used to allow a pause at the end of the screen when displaying error messages for files that can't be copied (for example: a file cannot be copied onto itself, several files cannot be copied onto one file under MSX-DOS 2 / Nextor). This parameter is only available under MSX-DOS 2 / Nextor.

/A is used to perform the copying operation in ASCII mode. Source files are read up to the first end-of-file character (CTRL-Z) and a single end-of-file character is appended to the destination after all data has been written out. This parameter can be given globally (at the beginning of the command) or separately for any source file and destination file. Under MSX-DOS 1, this parameter continues to be applied to next mentioned files until the /B parameter is used.

/B is used to perform the copying operation in binary mode. No interpretation is given to the data read and no additional data is added. This parameter can be given globally (at the beginning of the command) or separately for any source file and destination file. Under MSX-DOS 1, this parameter continues to be applied to next mentioned files until the /A parameter is used.

/V is used to turn write verification on for the duration of the COPY command (see the VERIFY command). This will ensure that data are written correctly to disks if the device driver being used has the feature, but will slow the operation down for the verification. This parameter is only available under MSX-DOS 2 / Nextor.

/T allows to use the current date and hour for the destination files instead of the time and hour of the source files. This parameter is only available under MSX-DOS 2 / Nextor.

Note: The destination files will not be hidden or read-only under MSX-DOS 2 / Nextor, regardless of the attributes of the source files. The ATTRIB command can be used to change these.

Examples

Only under MSX-DOS 1

A>COPY TESTFILE.BAS B:TEST.BAS
A>COPY A:FILE1.TXT + B:FILE2.TXT A:NEWFILE.TXT
A>COPY TESTA.COM /B + TESTB.COM TESTC.COM /A
A>COPY *.TXT + *.TEX COMPLETE.TXT
A>COPY /B TEST1.COM + TEST2.COM

Under MSX-DOS 1 and higher

A>COPY FILE1 B:
A>COPY C:TESTFILE.BAS D:
A>COPY TEST.TXT CON
A>COPY CON TEST.TXT
A>COPY /A AUX CON

Under MSX-DOS 2 / Nextor

A>COPY /H  MSXDOS2.SYS + COMMAND2.COM  B:
A>COPY A:\DIR1 B:\DIR1 /V
A>COPY B:
A>COPY *.DOC B:/T

Related to

ATTRIB, BUFFERS, CONCAT, DEL, ERASE, FORMAT, MOVE, RENAME, SET, VERIFY

Compatibility

MSX-DOS 1 with COMMAND.COM, MSX-DOS 2 / Nextor with COMMAND2.COM v2.20 and higher