Rename

(Engine-Level Function)

Description: Renames an existing file.
Returns: Nothing
Usage: Script Only.
Function Groups: File I/O
Related to: GetFileAttribs | SetFileAttribs
Format: Rename(OldName, NewName)
Parameters:  
OldName
Required. Any text expression for the current name of the file to be changed. A known path Known Path Aliases for File-Related Functions may be provided in the form, :{KnownPathAlias}.
NewName
Required. Any text expression for the new name that the file is to be changed to. A known path alias may be provided in the form, :{KnownPathAlias}.
Comments: This statement will rename the file regardless of its attributes and the attributes will not be changed. If the file to be renamed does not exist, a file will not be created.

This function is session non-aware, meaning it works on the server's file system even with an active remote connection established. This function is also blocking, all concurrent thread operations will be paused until its execution has concluded.

Example:

Rename("C:\VTScada\MyApp\TestMod.SRC",
       "C:\VTScada\MyApp\Test1.SRC");

This statement changes the name of a file from "TestMod.SRC" to "Test1.SRC".