The name and optional path of the file or directory to be renamed
newpath(required; String)
The new name and optional path to give to the file
Description
The Rename procedure renames a file or directory.
Usage at a Glance
If oldpath does not exist or is currently in use, or if newpath already exists or contains an invalid path, an error occurs.
If newpath and oldpath include different directory paths, the file or directory will be renamed and moved to the new location. Directories cannot be moved from one drive to another using this method.
Path information included in newpath and oldpath can include relative or absolute paths and can use the drive-letter or UNC format.
Wildcard characters cannot be used.
Version Differences
The Rename procedure is new to VB under .NET.
Visual Basic 2005 includes My.Computer.FileSystem.RenameFile and My.Computer.FileSystem.RenameDirectory methods that provide similar functionality.