Reputation: 1
I need my program to delete all bmp files in a directory, currently I have
My.Computer.FileSystem.DeleteFile("*.bmp")
But it says the * is invalid, is the * not the right character to use in this context? if so, what is?
Upvotes: 0
Views: 51
Reputation: 3549
Dim fileEntries As String() = Directory.GetFiles(targetDirectory)
For each f in fileEntries
If file.GetExtension(f) = ".bmp" then
file.deleteFile(f)
End If
Next
I doing this from memory, but this should get you there.
you need to import system.io
of course
Upvotes: 1