DirectoryInfo.MoveTo moves a DirectoryInfo instance and its contents to a new path.
Imports System
Imports System.IO
Public Class MoveToTest
Public Shared Sub Main()
Dim di As New DirectoryInfo("TempDir")
If di.Exists = False Then
di.Create()
End If
Dim dis As DirectoryInfo = di.CreateSubdirectory("SubDir")
If Directory.Exists("NewTempDir") = False Then
di.MoveTo("NewTempDir")
End If
Try
dis.Delete(True)
Catch
End Try
End Sub
End Class