473,387 Members | 1,545 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Deleting a directory

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
5 1973
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
Did you check for hidden files?
Mar 29 '06 #3
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Guinness Mann | last post by:
Greetings, I can't figure out what to search on to find the documentation on how to completely delete a "solution" from VS.NET 2003. I have no problem at all deleting projects, but even if I...
5
by: Rosa | last post by:
Hi, I'm trying to clear the TIF on Windows XP programmatically with the below code. This code works fine on any folder but the TIF. For some reason the atEnd() statements always defaults to true...
6
by: Martin Bischoff | last post by:
Hi, I'm creating temporary directories in my web app (e.g. ~/data/temp/temp123) to allow users to upload files. When I later delete these directories (from the code behind), the application...
4
by: osh.sean | last post by:
I'm having a problem and I can't find anything about this anywhere else out there. I'm working on a solution that allows the end user to create folders / upload files to the web server. Some...
1
by: Lee | last post by:
Hi, when deleting a directory using;- string dir = "whatever"; Directory.Delete(dir); it fails if files/directories exist within the directory being deleted. is there an easy way of...
5
by: Sandeep Singh Sekhon | last post by:
I am Developing a Web Application with ASP.NET 1.1 I have one project Folder which is virtual directory of IIS. In this directory, I have one Folder named Photos in which I used to Store Photos....
2
by: vikram.lakhotia | last post by:
Hi Have you tried deleting a directory in Asp.Net. Here is an article discussing the problem deleting a Directory in Asp.Net http://www.vikramlakhotia.com/Deleting_Directory_in_ASPnet_20.aspx...
4
by: RKalai | last post by:
Hi I am moving list of files from one directory to another directory.i am doing it by first moving all the files from the source directory to destination directory using filecopy command.then...
3
by: Kimera.Kimera | last post by:
I'm trying to write a program in VB.net 2003 that basically deletes all files, folders, sub-folders and sub-sub folders (etc). The program is simply for deleting the Windows/Temp folder contents,...
12
Nepomuk
by: Nepomuk | last post by:
Hi! I want to have my program delete some folders including all contents. For that, I wrote this method: private static void delete(String source) { File tmp = new File(source);...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.