Deleting a directory

G

Gnic

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
 
G

Gnic

I found that everything in side the folder is delete, but not the folder
itself after I see the exception.

any clue?
 
J

Jeff

Gnic said:
yup, there is no hidden file.
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.
 
M

Michael Nemtsev

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top