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. Avoid using this function to access a network file path ("\\server1\share\file.txt", for example). If the network location is unavailable while a blocking File I/O function is attempted, it will block indefinitely. It is recommended that a target file be copied to the local file system for access rather than over the network from VTScada.
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".
