CopyFile


 

CopyFile>sourcepath,destinationpath

 

Copies the file (or files) or folder, sourcepath, to destinationpath

 

sourcepath, and destinationpath may be variables.  Wildcards can be used.  Source and destination may be folders.

 

By default if destinationpath already exists it will not be overwritten and the new file will be renamed appropriately.  It is possible to change the behaviour of the CopyFile command to overwrite instead by setting CF_OVERWRITE to 1.  The default value of CF_OVERWRITE is 0.

 

The outcome of the operation will be reported in variables CF_RESULT and CF_RESULT_CODE.  If the operation was aborted or could not proceed CF_RESULT will be False.  CF_RESULT_CODE will contain a numeric code returned by the operating system where 0 indicates success.  For details of the codes that may be returned see the SHFileOperation function documentation at msdn.microsoft.com.

 

To enable operating system file operation animations set CF_ANIMATE to 1.

 

Abbreviation : Cop

See also: MoveFile, DeleteFile, IfFileExists, AppendFile, RenameFile

 

Example

 

CopyFile>c:\temp\myfile.txt,c:\my documents\myfile.old

 

Or with variables:

 

Let>filename=c:\temp\myfile.txt

Let>newfilename=c:\temp\myfile.new

CopyFile>filename,newfilename