DelFiles

A very simple to delete a directory and the entire files and folders in its subdirectory structure (Tree).
It uses Dir object,


Public

Not Tested

Not My Work
Dim tempor As String, pos As Integer ' declarations
' function
Sub DelFiles(path)
pos = 0
tempor = Dir(path + "\*.*", 22)
Do While tempor <> ""
If tempor <> "." And tempor <> ".." Then
If (GetAttr(path + "\" + tempor) And 16) = 0 Then
SetAttr path + "\" + tempor, 0
Kill path + "\" + tempor
Else
DelFiles (path + "\" + tempor)
tempor = Dir(path + "\*.*", 22)
End If
End If
tempor = Dir
Loop
RmDir path
End Sub

path

Views 188 Downloads 68

VBA File System
ANmarAmdeen
718
Attachments
Revisions

v1.0