Dim fl As String = "g:\web\" For Each file As String In FileSys.GetFiles(fl) Dim idx As Integer = file.LastIndexOf(".") Dim ext As String = file.SubString(idx) Select Case ext Case ".jpg",".gif",".png",".bmp",".wmf",".txt" ' filesys.DeleteFile(file,2,2) End Select Next