Renames a directory.
Assembly: Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)
The path is not valid for one of the following reasons: it is a zero-length string; it contains only white space; it contains invalid characters; or it is a device path (starts with \\.\).
newName contains path information.
directory is Nothing.
newName is Nothing or an empty string.
The directory does not exist.
There is an existing file or directory with the name specified in newName.
The path exceeds 248 characters.
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 method cannot be used to move a directory; use the MoveDirectory method to move and rename the directory.
The following table lists an example of a task involving the My.Computer.FileSystem.RenameDirectory method.
Rename a directory
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.