The Copy Method of the ODAX ActiveX Object copies the specified source filename to the destination filename.
Copy (Method of the ODAX ActiveX Object) Syntax var status = object.Copy(srcFileName, destFileName);
Parameters
Items listed in this section indicate parameters, or attributes which can be set.
Name Possible Values Description
Default Value SrcFileName String Full path of the source file name that is to be copied N/A DestFileName String Full path of the destination file name N/A
Return Values
Name Description Status Returns 0 if no error is received. If an error occur, returns the value from the windows API call GetLastError()
Examples
The following example displays how to copy a file:
<SCRIPT> var ax = new ActiveXObject("CeODAX.ODAX"); var srcFileName = '\\application\\test.xml'; var destFileName = '\\windows\\test.xml'; var status = ax.Copy(srcFileName, destFileName); </SCRIPT>
Copy example to clipboard
Remarks
GeneralIt's good practice to check if the file exists before copying it. To do this use FileExists() method. This will support any file extension and will work as per normal file copy command. If file already exists with the same name in the destination folder/path it would be overwritten.
Additional Information
Supported Platforms Windows Mobile, Windows CE Persistence Runs immediately. Min. Requirements None.