删除指定目录及其子目录和文件

private void deletefile(System.IO.DirectoryInfo path)
{
foreach(System.IO.DirectoryInfo d in path.GetDirectories())
{
deletefile(d);
}
foreach(System.IO.FileInfo f in path.GetFiles())
{
f.Delete();
}
}

你可能感兴趣的:(文件)