How to delete a directory using VB.NET

This aricle explains how we can delete a directory using VB.NET.You can delete a directory or sub directory by using Directory class's Delete method.
  • 1642

You can delete a directory or sub directory by using Directory class's Delete method. The Directory class is defined in System.IO namespace so don't forgot to add reference System.IO.dll by using Add Reference and call using System.IO.

Say I want to delete a sub directory dump in 'C:\\dump'.

Imports System.IO
Friend Class TestDirectory
Public Shared Sub Main()
Directory.Delete("C:\dump")
End Sub
End
Class

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.