View Single Post
  #6 (permalink)  
Old June 12th, 2003, 02:30 PM
DennisTh DennisTh is offline
Registered User
 
Join Date: Jun 2003
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanx for your help - here is the result which does the works :D

Regards

Dennis
Code:
    Sub deldir(ByVal targetDirectory As String)
        If Directory.GetDirectories(targetDirectory).Length > 0 Then
            Dim subdirectoryEntries As String() = Directory.GetDirectories(targetDirectory)
            Dim subdirectory As String
            For Each subdirectory In subdirectoryEntries
                deldir(subdirectory)
                Dim dirEntry As File
                dirEntry.SetAttributes(subdirectory, FileAttributes.Normal)
                Directory.Delete(subdirectory)
            Next
        End If

        Dim fileEntries As String() = Directory.GetFileSystemEntries(targetDirectory)
        Dim fileEntry As File
        Dim sFile As String
        For Each sFile In fileEntries
            fileEntry.SetAttributes(sFile, FileAttributes.Normal)
            fileEntry.Delete(sFile)
        Next
    End Sub
Reply With Quote