Does anybody have a sample or no how to delete a lot of files and sub directories in a folder with threads and c# .net.
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The best way is to call
Directory.Delete(directory, true);That will delete the directory, all of the subdirectories, and all files. No threading required.If you want to do it asynchronously (i.e. have your program do other things while the directory deletion is happening), then take a look at Calling Synchronous Methods Asynchronously.