copyfile
PATH
,
NEWPATH

The copyfile statement copies a file or folder.


Parameters

This statement has two parameters:

path – is a path to the file or 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.


Description

This statement copies an item on disk. The item may be a single file or an entire folder.

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:

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 must already exist. For example, this copyfile statement will fail if either the Projects or Artwork folders don’t already exist (see the MakeFolder statement if you need to create a folder).

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 CopyFolder Statement

Previous versions of Panorama (version 6 and before) had a separate statement, copyfolder, for copying folders instead of files. Since the copyfile statement can now copy folders as well as indivicual files, this statement is no longer necessary. However, it is still available for compatibility with existing databases. (The copyfolder statement is actually an alias for the copyfile statement, and can copy both folders and individual files.)

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


History

VersionStatusNotes
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).