hi,
does anyone know how to delete a folder in c# regardless it contains a file or not or a file within it is being locked or use?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Nilanka DharmadasaPosted Jan 13, 2010, 5:07 AM
Hi Ronald,
First you remove the readonly attribute of all the files. For that you should check all the files in the folder and also the files in the sub folders.
After removing readonly attribute, you can simply delete it from one line.Check my code. I have written a method to remove the readonly attribute and then delete the folder.
Please do not forget to tick 'Do you like this answer' checkbox if this helps you.
Lalit MPosted Jan 12, 2010, 11:29 PM
http://www.dotnetspider.com/resources/16119-create-delete-folder.aspx