Option Base 0
Sub DelFiles()
Const TestMode = True 'True suppresses file-deletion; False processes file-deletion
Dim AFile, RootPath, RetVal As String
Dim i As Integer
Dim DirPath()
'Initialize
RootPath = "C:\General\"
ReDim DirPath(0)
'Any shortcut that it should automatically select each subfolder one by one?
'Collect Sub-Directories
ChDir RootPath
RetVal = Dir("*", vbDirectory) 'process ".", not needed
RetVal = Dir() 'process "..", not needed
RetVal = Dir() 'Get First to keep
Do While RetVal <> ""
If RetVal <> "" Then
ReDim Preserve DirPath(UBound(DirPath) + 1)
DirPath(UBound(DirPath)) = RootPath & RetVal & "\"
RetVal = Dir()
End If
Loop
'Loop through directories+files
For i = 1 To UBound(DirPath) 'directories
RootPath = DirPath(i)
AFile = Dir(RootPath & "*.*") 'get first file
Debug.Print: Debug.Print Now
Do
'Please note I wish to keep Ad*.*, Bv*.*, and La*.*
'test the filename
Select Case UCase(Left(AFile, 2))
Case Is = "AD", "BV", "LA"
Debug.Print "Leaving " & RootPath & AFile
Case Else
Debug.Print "Deleting " & RootPath & AFile
If Not TestMode Then
Kill RootPath & AFile 'Delete File
End If
End Select
AFile = Dir() 'Get next file
Loop While AFile <> "" 'go until no files
Next i '/directory
End Sub