Mega Code Archive

 
Categories / VB.Net / File Directory
 

Create and delete directory with DirectoryInfo

Imports System Imports System.IO Public Class Test     Public Shared Sub Main()         Dim di As DirectoryInfo = New DirectoryInfo("c:\MyDir")         Try             If di.Exists Then                 Console.WriteLine("That path exists already.")                 Return             End If             di.Create()             di.Delete()         Catch e As Exception             Console.WriteLine("The process failed: {0}", e.ToString())         End Try     End Sub End Class