Skip to main content

Rename

Command Description

Specify a file or folder path and rename the corresponding file or folder. If the specified path is illegal or a file or folder with the same name already exists, an exception will be thrown and the operation will be stopped

Command Prototype

File.RenameEx(sPathSrc,sNewName)

Parameter Description

ParameterRequiredTypeDefaultDescription
sPathSrcTruepath'''C:\Users'''The path of the file or folder that needs to be renamed, you can fill in the absolute path or use the @res "path" form to indicate the path under the res folder of the current process. The path separator needs to be escaped, such as "C:\Laiye RPA" or @ res "Laiye RPA\Laiye RPA"
sNewNameTruestring""The name after modifying the name of the corresponding file or folder in the specified path

Demo

/************************************Rename*********** **************************** 
Command prototype:
File.RenameEx('''C:\Users''',"")
Input parameters:
sPathSrc--file or folder path that needs to be renamed
sNewName--name after modifying the name of the corresponding file or folder in the specified path
Outgoing parameters:
None
********************************************************************************/
Dim sPathSrc='''C:\Users\Chance\Desktop\testFile\tempFolder'''
Dim sNewName="newTempFolder"
File.RenameEx(sPathSrc,sNewName)