Option Explicit
Public Sub KillTempDir(ByVal DelFolder As String)
On Error Resume Next
Dim RetStr As String
Kill DelFolder & "*.*"
TryAgain:
RetStr = Dir$(DelFolder, vbDirectory)
Do
If Len(RetStr) = 0 Then
Exit Sub
End If
If RetStr <> "." And RetStr <> ".." Then
KillTempDir DelFolder & RetStr & "\"
RmDir DelFolder & RetStr
If Err.Number <> 0 Then GoTo TryAgain
End If
RetStr = Dir$()
Loop
End Sub