FileCopy PowerScript function
Description
Copies one file to
another, optionally overwriting the target file.
Syntax
|
1 |
<span>FileCopy</span> ( <span>sourcefile</span>, <span>targetfile</span> {, <span>replace</span> } ) |
|
Argument |
Description |
|---|---|
|
sourcefile |
String for the name of the file you want |
|
targetfile |
String for the name of the file you are |
|
replace |
Boolean specifying whether to replace |
Return Values
Integer. Returns values as follows:
-
1 – Success
-
-1 – Error opening sourcefile
-
-2 – Error writing targetfile
Usage
If you do not specify a fully qualified path for sourcefile or
for targetfile, the function works relative
to the current directory. If you do not specify the replace argument,
the FileCopy function does not replace a file
in the target directory that has the same name as the name you specify
in the targetfile argument (This is equivalent
to setting the replace value to false).
Examples
The following example copies a file from the current
directory to a different directory and saves the return value in
a variable. It does not replace a file of the same name if one already
exists in the target directory:
|
1 |
integer li_FileNum |
|
1 |
li_FileNum = <span>FileCopy</span> ("jazz.gif" , &<br>   "C:emusicjazz.gif", FALSE) |