/// <summary> /// 删除文件夹所有内容 /// </summary> /// <param name="path">文件DirectoryInfo</param> 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(); } }