The copyfile statement copies a file (or folder).


This statement has two parameters:

path – is a path to the file or folder to be renamed and/or moved, including the file name (see Files and Folders for more information about file paths).

newpath – is the new name for the newly copied file or folder, or an entirely new path if the file or folder is to be copied to a new location.


This statement copies an item on disk. The item may be a single file or an entire folder (though for a folder the CopyFolder statement is generally recommended).

To copy an item in the same folder, the first parameter specifies the file or folder, while the second specifies the new name. This example causes the file index.html to be copied as home.html within the Web Site folder:

copyfile "~/Documents/Web Site/index.html","home.html"

The copyfile statement can also copy an entire folder, including all of the contents of the folder. This example copies the Web Site folder into a new folder, Acme Web Site, inside the Documents folder (note, however, that this will not work if the Acme Web Site folder already exists, if that is a possibility, use the CopyFolder statement instead):

copyfile "~/Documents/Web Site","Acme Web Site"

If the second parameter contains a full path, the item will be copied to a new location (and will also be renamed, if the file name is different). This example copies a file from the Documents folder into the Dropbox folder:

copyfile "~/Documents/logo.png","~/Dropbox/logo.png"

You can copy and rename an item all in one fell swoop"

copyfile "~/Documents/logo.png","~/Dropbox/newlogo.png"

You can also copy an entire folder all at once.

copyfile "~/Documents/Web Site","~/Dropbox/Acme Web Site"

When copying an item to a new location, that location will be created if it does already exist (this is only true for Panorama X 10.2 and later). For example, this copyfile statement will automatically create the Projects or Artwork folders if don’t already exist. This eliminates the need to use the MakeFolder statement to create the necessary folders.

copyfile "~/Dropbox/logo.png","~/Documents/Projects/Artwork/logo.png"

If you want to move an item instead of copying it, use the FileRename statement.

Legacy BufferSize Parameter

Previous versions of Panorama (version 6 and before) had an optional buffersize parameter for the copyfile statement:

copyfile path,newpath,buffersize

For compatibility with existing databases the copyfile statement can still include a buffersize parameter, but it is ignored.

See Also


10.2UpdatedThis statement now creates the destination folder if necessary, and will replace the destination file if it already exists.
10.0UpdatedCarried over from Panorama 6.0 but now can copy entire folders as well as individual files. You can also now copy an item within the same folder simply by specifying the new name for the copied file (it's not necessary to include the complete path).