Please enable JavaScript to view this site.

R:BASE 11 Help

Navigation: Command Index > C

COPY (Short Name: COP)

Scroll Prev Top Next More

Use the COPY command to copy or combine files.

 

COPY

 

Options

 

filesource

Specifies the file to be copied, the source file

 

filetarget

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.

 

The COPY command will combine multiple ASCII source files into a single target file.

 

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 backup your database, command files, and programs. When copying a database, copy all four database files as a set.

 

If you change the file extension when you use COPY to backup your database files, you must change the extension back to the original extension 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 or UNLOAD commands.

 

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 file-based commands.

 

Examples

 

The following command copies the file ThisFile.txt to ThatFile.txt on the current drive and directory.

 

COPY ThisFile.txt ThatFile.txt

 

The following command copies the MyData.dat file on drive C:\ to the current directory on drive E:| using the same file name.

 

COPY C:\MyData.dat E:\MyData.dat

 

The following command copies any files in the DBS directory that begin with MYDATA and have the extension .RX? to the ADMIN directory on the current drive using the same file names. The files with the .RX? extension could be the four disk files that contain an R:BASE database: MyData.RX1, MyData.RX2, MyData.RX3, and MyData.RX4.

 

COPY /DBS/MyData.rx? /admin

 

The following command copies the MYDATA database files using the new name SAVEDATA.

 

COPY MyData SaveData

 

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

 

COPY MyData.rx? MyData.sv?

 

The following command combines the files FileHeader.txt and FileList.txt into FullContent.txt

 

COPY FileHeader.txt+FileList.txt FullContent.txt