Directory Class Exposes static methods for creating, moving, and enumerating through directories and subdirectories
Imports System
Imports System.IO
Public Class Test
Public Shared Sub Main()
Dim path As String = "c:\MyDir"
Dim target As String = "c:\TestDir"
Try
' Determine whether the directory exists.
If Directory.Exists(path) = False Then
' Create the directory.
Directory.CreateDirectory(path)
End If
If Directory.Exists(target) Then
' Delete the target to ensure it is not there.
Directory.Delete(target, True)
End If
Catch e As Exception
Console.WriteLine("The process failed: {0}", e.ToString())
End Try
End Sub
End Class
Related examples in the same category