Copy File Method
The Copy File method copies a file. It does not return a value. You cannot use the following wildcards in any of the arguments:
* (asterisk)
? (question mark)
The Copy File method cannot copy the file that the source argument identifies in the following situations:
If Siebel VB opens this file for anything other than read access
If other code has already opened and is using the file
Format
FileCopy [path1]source, [path2]target
The following table describes the arguments that you can use with this method.
Argument | Description |
---|---|
path1 |
The path of the file to copy. If the value in the source argument does not reside in the current directory, then this argument is optional. |
source |
The name and, if necessary, the path of the file to copy. |
path2 |
The path to a directory. This method copies the file to this directory. If you require that this method not copy the file to the current directory, then the path2 argument is optional. |
target |
A name. This method copies the file to this name. |
Example
The following example copies one file to another file:
Sub Button_Click
Dim oldfile, newfile
On Error Resume Next
oldfile = "c:\temp\trace.txt"
newfile = "c:\temp\newtrace.txt"
FileCopy oldfile,newfile
If Err <> 0 then
msgtext = "Error during copy. Rerun program."
Else
msgtext = "Copy successful."
End If
End Sub