Copying a File

The COPY-FILE command may be used to rename and/or move files to a new dictionary. Only File Definition items may be operated on by COPY-FILE. After executing COPY-FILE, the original file is deleted.

Format

COPY-FILE [DICT] dict-name data-name

Parameter(s)

DICT

Specifies the file dictionary.

dict-name

Specifies the name of the dictionary.

data-name

Specifies the name of the data file.

COPY-FILE may only move File Definition items to dictionaries which are at the same level as the source dictionary. For example, the File Definition item in the Master Dictionary may not be copied to the SYSTEM dictionary or to a file dictionary; however, it may be copied to another account’s Master Dictionary.

The following is an example of the file TEST (existing at both the dictionary and data level) being copied to NEWFILE:

>COPY-FILE MD TEST

TO: NEWFILE

The result of the above example is a file with a dictionary named NEWFILE and a data file named TEST. To rename the data file named TEST, it must be referenced directly. For example:

>COPY-FILE DICT NEWFILE TEST

TO: NEWFILE

Renaming an account is the most powerful feature of COPY-FILE. The following is an example of an account being renamed:

>COPY-FILE SYSTEM ACCOUNT.PAY

TO: ACCOUNT.REC

SYSTEM is the system dictionary, ACCOUNT.PAY is the account to be renamed, and ACCOUNT.REC is the new account name.

See Also

Overview of File Management Commands

File Name Syntax

Item Lists

Creating Files

Creating mvBASIC Files

Clearing a File

Deleting Files

Copying File Items

Editing Items

Deleting Items