Delete all file using * symbol

  • Thread starter Thread starter Pujo Aji
  • Start date Start date
P

Pujo Aji

Hello,

I would like to create program which delete files using * symbol. I tried
to use this code but it is not working:
File.Delete(@"d:\example.*");//filename example, directory everthing, it
stop here : file not found

Any idea?

Thanks
Pujo
 
use System.IO.Directory.GetFiles to get a list of files that match the
pattern and delete them one at a time using File.Delete.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
Hello,

I would like to create program which delete files using * symbol. I tried
to use this code but it is not working:
File.Delete(@"d:\example.*");//filename example, directory everthing, it
stop here : file not found

Any idea?

Thanks
Pujo
 
Thank you, it is working fine.

Pujo

use System.IO.Directory.GetFiles to get a list of files that match the
pattern and delete them one at a time using File.Delete.
 
Back
Top