* Wildcard and FileExists

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can anyone tell me why the * wildcard does not work in the example below?

Rgds

Bruce

myDest = "C:\test\"
If fs.FileExists(myDest & "*.mdb") Then
fs.DeleteFile myDest & "*.mdb", True
End If
 
ummm... because FileExists expects to be given the full name of a single
file.

What are you wanting to do? Delete all files in a folder?
 
Then I would use a slightly different approach:


Dim strFile As String
strFile = Dir(myDest & "*.mdb")
Do While strFile <> ""
Kill myDest & strFile
strFile = Dir()
Loop
 
Back
Top