System. Rename Directory(String, String) Method
Renames a directory.
public: static void RenameDirectory(System::String ^ directory, System::String ^ newName);
public static void RenameDirectory (string directory, string newName);
static member RenameDirectory : string * string -> unit
Public Shared Sub RenameDirectory (directory As String, newName As String)
Path and name of directory to be renamed.
New name for directory.
newName contains path information.
Nothing or an empty string.
The directory does not exist.
There is an existing file or directory with the name specified in
The path exceeds the system-defined maximum length.
A file or directory name in the path contains a colon (:) or is in an invalid format.
The user lacks necessary permissions to view the path.
The user does not have required permission.
This example renames the
Test directory to
This method cannot be used to move a directory; use the
MoveDirectory method to move and rename the directory.