how to delete files with certain kind of extensions using wild card in vb.net

How do I delete files from a directory that ends up with certain kind of extensions?? or how to use wild cards in the name?  This has to be done from a vb.net application.
jainkoraAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Éric MoreauSenior .Net ConsultantCommented:
give a try to the Process class

Process.Start "del c:\YourFolder\*.foo"

See http://www.utmag.com/wconnect/wc.dll?LevelExtreme~9,7,10,,176 for more details on how to use the Process class.
DaHaCommented:
Another way to do this if you want to have a little more internal control would be a function not unlike:

   Public Sub DeleteFiles(ByVal directory As String, ByVal extension As String)
      Dim filesToDelete As String()
      filesToDelete = System.IO.Directory.GetFiles(directory, "*." + extension)
      For Each thisFile As String In filesToDelete
         System.IO.File.Delete(thisFile)
      Next
   End Sub

Which you would call with:

   DeleteFiles("C:\Path\To\Directory", "xml")

This method goes to the specified directory, returns a list of all of the files within with the extension specified... and deletes each file one by one in a loop.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.