tag:blogger.com,1999:blog-1528805174514452404.post1799357430020989312..comments2024-03-27T17:10:25.297-04:00Comments on Allen Conway: How To: Use Recursion in .NET To Delete All Files and Directories in .NETAllen Conwayhttp://www.blogger.com/profile/07010967958393033081noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-1528805174514452404.post-63176067393821167172016-08-15T16:51:54.976-04:002016-08-15T16:51:54.976-04:00Thank you providing this. It assisted on some work...Thank you providing this. It assisted on some work I was doing on directories. This saved me a ton of time trying figure what needed to be in various sections. I especially appreciate your use of recursion.Andy Andersonnoreply@blogger.comtag:blogger.com,1999:blog-1528805174514452404.post-83699128318999094362013-07-18T11:54:29.080-04:002013-07-18T11:54:29.080-04:00Allen, this is great! I had some additional quest...Allen, this is great! I had some additional questions and your "contact me" doesn't work on this page...how can I contact you to ask my questions?Anonymoushttps://www.blogger.com/profile/06379862652753767036noreply@blogger.comtag:blogger.com,1999:blog-1528805174514452404.post-25469484762220175302010-10-29T10:15:19.953-04:002010-10-29T10:15:19.953-04:00Very nice, but surely we should get rid of the fil...Very nice, but surely we should get rid of the files before the directories?<br /><br />DirectoryInfo di = new DirectoryInfo(dirToClean);<br />di.GetFiles().ToList().ForEach(f => f.Delete());<br />di.GetDirectories().ToList().ForEach(d => d.Delete(true));Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1528805174514452404.post-4599928116146446582010-06-16T07:00:30.944-04:002010-06-16T07:00:30.944-04:00To clean up a directory using LINQ:
DirectoryInfo...To clean up a directory using LINQ:<br /><br />DirectoryInfo di = new DirectoryInfo(dirToClean);<br />di.GetDirectories().ToList().ForEach(d => d.Delete(true));<br />di.GetFiles().ToList().ForEach(f => f.Delete());Anonymousnoreply@blogger.com