Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Delete(strDirPath, true) gives "the directory is not empty"

Reply
Thread Tools

Delete(strDirPath, true) gives "the directory is not empty"

 
 
codeboy
Guest
Posts: n/a
 
      06-08-2009
I am using VS2008 to create a website. When I try to programmatically delete
a directory that is located within my website I will get an error. I am
trying to delete the directory using “System.IO.Directory.Delete(strDirPath,
true)”. This is the message the error gives "the directory is not empty". I
found another entry titled “Directory.Delete of a non empty dir fails in
ASP.NET application”. In that posting Walter Wang says: “the folder is
locked by Visual Studio 2005 IDE if the folder is already shown in project
explorer”. Now that I am using VS2008 has this been changed? How can I test
my code? Please help me get past this problem.

Thanks
 
Reply With Quote
 
 
 
 
Juan T. Llibre
Guest
Posts: n/a
 
      06-08-2009
re:
!> How can I test my code?

Create an IIS virtual directory and test directory.delete with VS 2008 closed.

You can undo the IIS virtual directory when you've finished testing directory.delete.

When done testing directory.delete, open VS 2008 and continue testing the rest of the code.




Juan T. Llibre, asp.net MVP
Estas probando VS 2010 y ASP.NET 4.0 ?
Regstrate (gratis) en los Foros de VS 2010 y ASP.NET 4.0, en espaol
http://asp.net.do/foros/forums/
================================================== ===
"codeboy" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I am using VS2008 to create a website. When I try to programmatically delete
> a directory that is located within my website I will get an error. I am
> trying to delete the directory using "System.IO.Directory.Delete(strDirPath,
> true)". This is the message the error gives "the directory is not empty". I
> found another entry titled "Directory.Delete of a non empty dir fails in
> ASP.NET application". In that posting Walter Wang says: "the folder is
> locked by Visual Studio 2005 IDE if the folder is already shown in project
> explorer". Now that I am using VS2008 has this been changed? How can I test
> my code? Please help me get past this problem.
>
> Thanks




 
Reply With Quote
 
 
 
 
codeboy
Guest
Posts: n/a
 
      06-08-2009
This seems like a very cumbersome way of tying to handle the problem. I also
like to use the debugging tools. They will not be available if VS2008 is
closed. I need a way of testing my code within the development environment
without getting this error. How can I do this?

"Juan T. Llibre" wrote:

> re:
> !> How can I test my code?
>
> Create an IIS virtual directory and test directory.delete with VS 2008 closed.
>
> You can undo the IIS virtual directory when you've finished testing directory.delete.
>
> When done testing directory.delete, open VS 2008 and continue testing the rest of the code.
>
>
>
>
> Juan T. Llibre, asp.net MVP
> ¿ Estas probando VS 2010 y ASP.NET 4.0 ?
> Reg*strate (gratis) en los Foros de VS 2010 y ASP.NET 4.0, en español
> http://asp.net.do/foros/forums/
> ================================================== ===
> "codeboy" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> >I am using VS2008 to create a website. When I try to programmatically delete
> > a directory that is located within my website I will get an error. I am
> > trying to delete the directory using "System.IO.Directory.Delete(strDirPath,
> > true)". This is the message the error gives "the directory is not empty". I
> > found another entry titled "Directory.Delete of a non empty dir fails in
> > ASP.NET application". In that posting Walter Wang says: "the folder is
> > locked by Visual Studio 2005 IDE if the folder is already shown in project
> > explorer". Now that I am using VS2008 has this been changed? How can I test
> > my code? Please help me get past this problem.
> >
> > Thanks

>
>
>
>

 
Reply With Quote
 
Juan T. Llibre
Guest
Posts: n/a
 
      06-08-2009
re:
!> This seems like a very cumbersome way of tying to handle the problem.

Given that VS 2008 locks the directory, it's the only way to do it.

re:
!> I also like to use the debugging tools. They will not be available if VS2008 is closed.

Of course not, but testing directory.delete doesn't really require a lot of debugging, does it ?
Do a simple test...and learn the correct way to handle directory deletions in IIS.

re:
!> I need a way of testing my code within the development
!> environment without getting this error. How can I do this?

File a bug report and wait for it to be fixed.

Also, you might want to check to see whether any files are in the directory.
You'll have to delete the files first before deleting the directory.

Also, are you sure the directory is not set as a read-only directory ?

See code to do that at :
http://www.eggheadcafe.com/conversat...eadid=33307218




Juan T. Llibre, asp.net MVP
Estas probando VS 2010 y ASP.NET 4.0 ?
Regstrate (gratis) en los Foros de VS 2010 y ASP.NET 4.0, en espaol
http://asp.net.do/foros/forums/
================================================== ===
"codeboy" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> This seems like a very cumbersome way of tying to handle the problem. I also
> like to use the debugging tools. They will not be available if VS2008 is
> closed. I need a way of testing my code within the development environment
> without getting this error. How can I do this?
>
> "Juan T. Llibre" wrote:
>
>> re:
>> !> How can I test my code?
>>
>> Create an IIS virtual directory and test directory.delete with VS 2008 closed.
>>
>> You can undo the IIS virtual directory when you've finished testing directory.delete.
>>
>> When done testing directory.delete, open VS 2008 and continue testing the rest of the code.
>>
>>
>>
>>
>> Juan T. Llibre, asp.net MVP
>> Estas probando VS 2010 y ASP.NET 4.0 ?
>> Regstrate (gratis) en los Foros de VS 2010 y ASP.NET 4.0, en espaol
>> http://asp.net.do/foros/forums/
>> ================================================== ===
>> "codeboy" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> >I am using VS2008 to create a website. When I try to programmatically delete
>> > a directory that is located within my website I will get an error. I am
>> > trying to delete the directory using "System.IO.Directory.Delete(strDirPath,
>> > true)". This is the message the error gives "the directory is not empty". I
>> > found another entry titled "Directory.Delete of a non empty dir fails in
>> > ASP.NET application". In that posting Walter Wang says: "the folder is
>> > locked by Visual Studio 2005 IDE if the folder is already shown in project
>> > explorer". Now that I am using VS2008 has this been changed? How can I test
>> > my code? Please help me get past this problem.
>> >
>> > Thanks

>>
>>
>>
>>




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
System.IO.Directory.GetDirectories() and System.IO.Directory.GetFiles() are not returning the specified directory Nathan Sokalski ASP .Net 2 09-06-2007 03:58 PM
directory as application in IIS gives Could not load type =?Utf-8?B?VGhvbWFzIEQu?= ASP .Net 0 06-11-2004 10:04 AM
directory as application in IIS gives Could not load type =?Utf-8?B?VGhvbWFzIEQu?= ASP .Net 0 06-11-2004 10:03 AM
directory as application in IIS gives Could not load type =?Utf-8?B?VGhvbWFzIEQu?= ASP .Net 0 06-10-2004 10:08 AM



Advertisments