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

Deleting a directory

P: n/a
Hi

I am trying to delete a directory and with the resursive parameter set to
true

Directory.Delete(@"c:\MyFolder", true);

but I got an IOException saying "The directory is not empty".

I thought that it won't complain about this if I set resursive to true?

any clue?

thanks

Gnic
Mar 29 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
I found that everything in side the folder is delete, but not the folder
itself after I see the exception.

any clue?
"Gnic" <ga****@gmail.com> wrote in message
news:eL**************@tk2msftngp13.phx.gbl...
Hi

I am trying to delete a directory and with the resursive parameter set to
true

Directory.Delete(@"c:\MyFolder", true);

but I got an IOException saying "The directory is not empty".

I thought that it won't complain about this if I set resursive to true?

any clue?

thanks

Gnic

Mar 29 '06 #2

P: n/a
Did you check for hidden files?
Mar 29 '06 #3

P: n/a
yup, there is no hidden file.
"Jeff" <ju******@jeff.net> wrote in message
news:As*******************@tornado.texas.rr.com...
Did you check for hidden files?

Mar 29 '06 #4

P: n/a
Gnic wrote:
yup, there is no hidden file.
"Jeff" <ju******@jeff.net> wrote in message
news:As*******************@tornado.texas.rr.com...
Did you check for hidden files?


I found this in MDSN about the Directory.Delete function exceptions:

Exception type Condition
IOException
A file with the same name and location specified by path exists.

-or-

The directory specified by path is read-only, or recursive is false and
path is not an empty directory.

-or-

The directory is the application's current working directory.

Mar 29 '06 #5

P: n/a
Hello Gnic,

Try to use ProcessExlorer tool, to find whether it working directory or not

G> I am trying to delete a directory and with the resursive parameter
G> set to true
G> Directory.Delete(@"c:\MyFolder", true);
G> but I got an IOException saying "The directory is not empty".
G> I thought that it won't complain about this if I set resursive to
G> true?
G> any clue?

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Mar 29 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.