protected void btn_Click(object sender, EventArgs e)
    {
        string name = this.txtbName.Text;//文件夹名称
        string path = Server.MapPath("~\\"+name);

   //存在以txtbName命名的文件夹,则删除
         if (Directory.Exists(path))
        {
            Directory.Delete(path, true); //true为递归删除子文件内容
            Response.Write("现在没有了");
        }    

     //不存在,则创建 
        else if (!Directory.Exists(path))
        {
            Directory.CreateDirectory(path);
            Response.Write("有了");
        }
    }

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-13
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-19
  • 2021-09-20
相关资源
相似解决方案