Siebel VB Language Reference > Methods Reference for Siebel VB > File Control Methods >

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 is not 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 the directory to which this method must copy the file. If the file is not to be copied to the current directory, then the path2 argument is optional.

target

The name to which this method must copy the file.

Example

The following example copies one file to another file. The user specifies these file names:

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

Siebel VB Language Reference Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Legal Notices.