SpartaDOS X Reference Manual

The Command Processor — Commands




COPY  Command

Index


Purpose Copies one or more files to another drive and, optionally, gives the copy a different name if specified

COPY also copies files to the same disk. In this case, you must give the copies different names unless different directories are specified; otherwise, the copy is not permitted. Concatenation (combining of files) can be performed during the copy process with the "/A" parameter.

You can also use the COPY command to transfer data between any of the system devices. Some applications of this would be to create a batch file or to print a text file.

To copy files with a single disk drive and no RAMDISK, see the MENU command. MENU has a provision for disk swapping, while COPY does not.
 

Syntax COPY [d:][path][fname][.ext] [d:][path][fname][.ext][/A]
 
Type Internal
 
Related MENU, TYPE
 
Remarks   The first filespec specified is the source file name. If none is given, a default filespec of "*.*" is assumed (which will copy all files in that directory). The device for the source file should be given; however, it is possible to omit the source device if you use commas (instead of spaces) to separate parameters, for example:

    COPY, ,D3:

will copy all files from the default drive/directory to the current directory of drive 3. The second filespec is the destination — if no filename is specified, a default filespec of "*.*" is assumed (which will copy the files without changing the names).

You may use wildcards ('*' and '?') in both source and destination filespecs. If used in the pathnames, the first directory match will be used.

When using wildcards with the COPY command, the same renaming convention as in the RENAME command is used. The source filespec is used to find directory matches, and the destination filespec renames them by overriding characters in the source name with the non-wildcard character in the corresponding position of the destination name.

If you are copying from a device other than "DSK:" (alias "Dn:" or just "n:"), then just one file is copied and the destination filespec is the name that the file will be saved under. For example:

    COPY CON: B:*

is illegal because you may not have wildcard characters in a destination filename when COPYing from a character device (or for that matter SAVEing any file). However, if copying from one character device to another character device, filenames are not used. (Character devices never use filenames.) For example:

    COPY CON: PRN:

As in the above two examples, when COPYing from "CON:" you signal the end of file by pressing a <CTRL-3> after typing the text. Also, a <RETURN> must follow each line you enter, otherwise that line will be lost.

Another use for the COPY command is to list files to the printer or screen, for example:

    COPY README.DOC CON:

will display the contents of "README.DOC" to the screen and:

    COPY README.DOC PRN:

will send it to the printer. Note that both of the above examples could have been performed with the TYPE command as follows:

    TYPE README.DOC
    TYPE README.DOC >>PRN:

with the second command sending the contents of the file to the printer.

You may also append files using the COPY command by using a "/A" immediately following (no space) the destination filespec. (SpartaDOS 3.2 allows a "/A" when SAVEing any file to force append mode — SpartaDOS X only supports this feature on the COPY command.)

If you only have one drive and wish to COPY files from one diskette to another, you must either COPY the file from the source diskette to a RAMDISK and then from the RAMDISK to the destination diskette, or use the MENU program as it allows disk swapping during copying.


Previous page

Next page