RenameDirectory |
Top Previous Next |
The RenameDirectory command allows you to give a specified directory a new name.
Command Syntax
RenameDirectory:[SourceDirectory],[NewDirectoryName],[DuplicateNameAction]
The colon after the command and the comma 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:
SourceDirectory: The fully qualified path identifying the directory to rename NewDirectoryName: The new name for the directory without any path information DuplicateNameAction: A string representing a valid member of the DuplicateNameAction enumeration, currently one of the following values: None, IncrementAlpha
The SourceDirectory and NewDirectoryName parameters are compulsory. If either 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 source directory and new directory name. It is good practice to include the quotation marks in any case, so that it reduces the risk of error when writing scripts. The DuplicateNameAction parameter is optional, and if not specified will default to DuplicateNameAction.None
Example:
Simple rename:
RenameDirectory:"C:\Test","Test Renamed"
Rename the directory, but if a directory of that name already exists automatically increment the new directory name:
RenameDirectory:"C:\Test","Test Renamed 1",IncrementAlpha
Result: If the directory Test Renamed 1 already exists, the new name would be 'Test Renamed 1a'
See Also: CreateDirectory DeleteDirectory MoveDirectory
|