By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,140 Members | 1,295 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,140 IT Pros & Developers. It's quick & easy.

Deleting directories!

P: n/a

when deleting a directory using;-

string dir = "whatever";

it fails if files/directories exist within the directory being deleted. is
there an easy way of deleting the directory and all contents without having
to recurse through the entire directory deleting each one ?

thanks in advance
May 22 '06 #1
Share this Question
Share on Google+
1 Reply

P: n/a
there is overload where you specify recurse

Directory.Delete (String, Boolean) Deletes the specified directory
and, if indicated, any subdirectories in the directory.
System.IO.Directory.Delete("c:\MyDir\temp", true);
I hope this helps
Galin Iliev[MCSD.NET]

May 22 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.