删除文件夹所有内容

    /// <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();
       }
   }  

 

posted @ 2018-09-19 08:23  net开发人员  阅读(167)  评论(0编辑  收藏  举报