Return to Snippet

Revision: 29511
at July 31, 2010 01:05 by krlogin11


Initial Code
Public Shared Sub EmptyDirectory(ByVal _dirPath As String)
        If Not Directory.Exists(_dirPath) Then
            Return
        End If
        Dim files() As String
        files = Directory.GetFileSystemEntries(_dirPath)
        For Each element As String In files
            'Do not clear sub directories
            If (Not Directory.Exists(element)) Then
                DeleteFile(Path.Combine(_dirPath, Path.GetFileName(element)))
            End If
        Next
    End Sub

Initial URL


Initial Description


Initial Title
Delete All Files In Directory

Initial Tags


Initial Language
VB.NET