# CREATE FILE Create File Copy/Backup

> Source: https://manual.pvxplus.com/directives/create-file

## Format

**CREATE FILE** *new_pathname* **FROM\[** *old_pathname* **|** (*chnl*) **\]** **\[**,**ERR**=*stmtref* **\]**

***Where:***

|  |  |
| --- | --- |
| *new_pathname* | Name of the output file to be created/updated. |
| *old_pathname* | Name of the current file to be copied/backed up. |
| *chnl* | Channel number of a currently open file that you want copied/backed up. |
| *stmtref* | Program line number or statement label to which to transfer control. |

## Description

Use the **CREATE FILE** directive to create a copy/backup of a file. The contents of *new_pathname* will be overwritten with the contents of the input file ***only*** if the file is the same type as the input file. If the output file does not exist, it will be created.

During the copy/backup, the input file will have a temporary internal lock placed against its contents to avoid any concurrent update.

When copying a link file, the **CREATE FILE** directive will copy the file link references, not the actual link file.

*(The CREATE FILE directive was added in PxPlus 2016.)*

## Example

The following is an example of the **CREATE FILE** directive with a channel:

```
open (1,iol=*)"clients"
create file "clients.backup" from (1)
```
