Siebel VB Language Reference > Siebel VB Language Reference >

FileCopy Statement


This standard VB function copies a file.

Syntax

FileCopy [path1]source, [path2]target

Argument
Description
path1
The path of the file to copy (optional unless source$ is not in the current folder)
source
The name, and if necessary, the path, of the file to copy
path2
The path to the folder to which the file should be copied (optional unless the file is to be copied to the current folder)
target
The name to which the file should be copied

Returns

Not applicable

Usage

Wildcards (* and ?) are not allowed in any of the arguments. The source file cannot be copied if it is opened by Siebel VB for anything other than Read access, or if it is open in another program.

Example

This example copies one file to another. Both filenames are specified by the user.

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

See Also

FileAttr Function
FileDateTime Function
GetAttr Function
Kill Statement
Name Statement


 Siebel VB Language Reference
 Published: 18 June 2003