Mega Code Archive

 
Categories / VB.Net / File Directory
 

Deletes the specified directory and subdirectories and files in the directory

Imports System Imports System.IO Public Class Test     Public Shared Sub Main()         Dim path As String = "c:\MyDir"         Dim subPath As String = "c:\MyDir\temp"         Try             If Directory.Exists(path) = False Then                 Directory.CreateDirectory(path)             End If             If Directory.Exists(subPath) = False Then                 Directory.CreateDirectory(subPath)             End If             Directory.Delete(path, True)         Catch e As Exception             Console.WriteLine("The process failed: {0}", e.ToString())         End Try     End Sub End Class