Siebel VB Language Reference > VB Language Reference >
This standard VB statement renames a file or copies a file from one folder to another.
Name [path1\]oldfilename As [path2\]newfilename
A string expression containing the path to the current location of the file (must be entered if the file is not in the current folder of the current drive)
A string expression containing the name of the file to be renamed
A string expression containing the path to the location where the renamed file should appear; if a path is not given, the file goes in the current folder of the current drive
A string expression containing the new name for the file
To be renamed, the file must be closed. If the file oldfilename is open or if the file newfilename already exists, Siebel VB generates an error message.
If this statement is used within the Siebel application, and no path2\ is specified, a copy of the original file goes in the
c:\siebel\bin folder under the new name.
This example creates a temporary file,
c:\temp001, renames the file to
c:\temp002, then deletes them both. It calls the subprogram
CreateFile to create the
Declare Sub CreateFile
Rem Put the numbers 1-10 into a file
Dim x as Integer
Open "C:\TEMP001" for Output as #1
For x = 1 to 10
Write #1, x
On Error Resume Next
Name "C:\TEMP001" As "C:\TEMP002"