0

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?

Techie
  • 1,491
  • 3
  • 18
  • 24
nymda
  • 1
  • 1

1 Answers1

1
  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

Nefariis
  • 3,451
  • 10
  • 34
  • 52