COPY (Short Name: COP)
Top  Previous  Next

Use the COPY command to copy files.

copy

Options

filespec1

Specifies the file to be copied-the source file.

filespec2

Specifies the file to receive the copy-the target file.

About the COPY Command

This command is similar to the operating system COPY command.

When you copy files from one drive to another, include the drive letter of the drive you want to copy to.

When you copy files from one directory to another directory, the name of the directory you want to copy to must be different from the current directory.

Naming Copied Files

When you copy a file from one drive or directory to another drive or directory, you can keep the same name for the new file, or you can give the file a new name. If you want to make a copy of a file on the same directory, you must give the file a different name. If the new name is the name of an existing file, COPY replaces the existing file with the file you are copying.

Using Wildcards with the COPY Command

When copying a group of files, you can use the operating-system wildcards (? or *) in the file specification. The settings for the R:BASE special characters SINGLE and MANY do not affect the operating system wildcards.

When the target name is the same length as the source name, the command succeeds. However, if the target name is shorter or longer than the source name, the results are unpredictable.

Backing Up with the COPY Command

You can use the COPY command to back up your database, command files, and programs. Copy the four .RB* files as a set.

If you change the .RB* extension when you use COPY to back up your database files, you must change the extension back to .RB* to use the database in R:BASE. The COPY command does not copy files onto multiple disks. If your database is too large to fit on one disk, use the BACKUP command.

Suggestion

On a workstation with multiple drives (local or mapped), especially when the files are on the different drive, it is always the best practice to define a drive letter when copying, deleting, renaming or running files, unless the specified files are located in the working directory. You will not need to specify the drive letter if all of the files are located in the default directory when using the copy, delete, rename or run commands.

Examples

The following command copies the file THISFILE to THATFILE on the current drive and directory.

COPY thisfile thatfile

The following command copies the MYDATA file on drive C: to the current directory on drive B: using the same file name.

COPY c:mydata b:mydata

The following command copies any files in the DBS directory that begin with MYDATA and have the extension .RB? to the ADMIN directory on the current drive using the same file names. The files with the .RB? extension could be the four disk files that contain an R:BASE database: MYDATA.RB1, MYDATA.RB2, MYDATA.RB3, and MYDATA.RB4.

COPY /dbs/mydata.rb? /admin

The following command copies the MYDATA files using the new name SAVDAT.

COPY mydata savdat

The following command copies the MYDATA files with an .RB? extension and changes the extension to .SV?

COPY mydata.rb? mydata.sv?