Mega Code Archive

 
Categories / VB.Net / File Directory
 

Directory Delete deletes an empty directory from a specified path

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)         Catch             Console.WriteLine("The Delete operation failed as expected.")         End Try     End Sub End Class