S

Public Sub DelTree32(DrvLtr As String, DeleteDIR As String)
Dim Result As String
Dim W As Integer
Dim X As Integer
Dim Y As Integer
Dim Z As Integer
Dim DIRList() As String
Dim FileList() As String
W = 0
Y = 0
Success = False
On Error Resume Next
ChDrive DrvLtr
If Not Err = 0 Then Exit Sub
ChDir (DrvLtr & "\" & DeleteDIR)
If Not Err = 0 Then Exit Sub
ChDrive DrvLtr
RmDir ("\" & DeleteDIR)
If Err = 0 Then
On Error GoTo 0
Success = True
Exit Sub
Else
Result = Dir((DrvLtr & "\" & DeleteDIR & _
"\*.*"), vbDirectory)
Do
If (Result = "." Or Result = "..") = False Then<br /> Exit Do<br /> Else<br /> Result = Dir()<br /> End If<br /> Loop<br /> Do<br /> If Result = "" Then Exit Do
If (GetAttr(DrvLtr & "\" & DeleteDIR & _
"\" & Result)) = vbDirectory Then
W = W + 1
ReDim Preserve DIRList(W)
DIRList(W) = Result
Else
Y = Y + 1
ReDim Preserve FileList(Y)
FileList(Y) = Result
End If
Result = Dir()
Loop
For X = 1 To W
Call DelTree32(DrvLtr, (DeleteDIR & "\" _
& DIRList(X)))
If Success = False Then Exit Sub
Next X
For Z = 1 To Y
Kill (DrvLtr & "\" & DeleteDIR & "\" & _
FileList(Z))
Next Z
ChDrive DrvLtr
RmDir ("\" & DeleteDIR)
Success = True
On Error GoTo 0
End If
End Sub

Anzeige

Zum Seitenanfang