Delete a directory in VB.NET

This article 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.
  • 3847

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

© 2018 DotNetHeaven. All rights reserved.