CSharp examples for System.IO:DirectoryInfo
Delete Directory
using System.Threading; using System.Windows.Forms; using System.Diagnostics; using System.Xml; using System.IO.Compression; using System.IO;//from w w w . j a va 2 s. c o m using System.Web; using System.Text; using System.Collections.Generic; using System.Configuration; using System; public class Main{ public static void DeleteDirectory(string targetDir) { DirectoryInfo dirInfo = new DirectoryInfo(targetDir); if (dirInfo.Exists) { DeleteDirectoryFiles(targetDir, true); dirInfo.Delete(true); } } }