Thursday, 13 July 2017

Delete Directory Which Contains Files In C#

7/13/2017 - By Pranav Singh 0



This article will show you how you can delete a folder which is containing any file using c#.net in windows application. So why I am writing this because if you try to delete any folder and that folder contains any file or folder it will throw and exception that folder contains some file.


So here is the code.

  if (Directory.Exists(folderpath))
       {
         Directory.Delete(folderpath, true);
       }

So check the above highlighted part. I have passed it true. So if we pass this true then only we will be able to delete the folder with some files.

Please let me know your comment................


About the Author

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Get Updates

Subscribe to our e-mail newsletter to receive updates.

Share This Post

0 comments:

Please let me know your view

Free Ebooks


About Us

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Contact Us

For writing article in this website please send request by your

GMAIL ID: dotnetpools@gmail.com

Bugs and Suggestions

As we all know that this website is for sharing knowledge and providing proper solution. So while reading the article is you find any bug or if you have any suggestion please mail us at contact@aspdotnet-pools.com.

Partners


Global Classified : Connectseekers.com
© 2014 aspdotnet-pools.com Designed by Bloggertheme9.
back to top