How to Delete Non-Empy Folder

Posted by Santosh4u under VB.NET on 2/3/2010 | Views : 7223 | Status : [Member] | Replies : 4
hi

can any body plz tell me how delete a Non-Empty Folder in vb.net.



Regards
Santosh




Responses

Posted by: Poster on: 2/4/2010 [Member] Starter

Up
0
Down
I am almost sure that this article will help you.

http://www.dotnetfunda.com/articles/article548-common-operation-with-files-and-folders-in-aspnet-.aspx

First you delete all the files of that folder and then try to delete that folder. This article has source code in C# you can convert it to VB.NET using converter (http://converter.telerik.com/).

Thanks

Santosh4u, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 2/4/2010 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
This can do it

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


the True mean that it can delete the subfolders if there are any

don't forget that they fall under the System.IO namespace.

Thank you for posting at Dotnetfunda

Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

Santosh4u, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Santosh4u on: 2/8/2010 [Member] Bronze

Up
0
Down
thanx Vuyiswamb
ur code is working fine.
once again thanx

Santosh4u, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 2/8/2010 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
Thank you for Posting at Dotnetfunda

Please mark my answer as "Answered"

Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

Santosh4u, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response