RenameFile

Top  Previous  Next

 

The RenameFile command allows you to Rename a specified file.

 

Command Syntax

 

RenameFile:[SourceFileName],[TargetFileName]

 

The colon after the command and the space between parameters are compulsory. Any additional spaces or characters will cause an error to be thrown. The command itself is not case sensitive, but parameters may be depending on the operating system and locale.

 

Parameters:

 

SourceFileName: The fully qualified path and file name identifying the file to rename

TargetFileName: The fully qualified path and file name to which the file should be renamed

 

All parameters are compulsory. If any parameter is missing or invalid an error will be thrown. The parameters must be surrounded by quotation marks if one or more spaces are included in the path and file name. It is good practice to include the quotation marks in any case, so that it reduces the risk of error when writing scripts.

 

Example:

 

RenameFile:"C:\Test Text.txt","C:\Test Text (Renamed).txt"

 

See Also: Conditional CopyFile DeleteFile MoveFile