c# 文件夾操作

时间:2023-03-10 08:49:39
c# 文件夾操作

#region 圖片對應異動
           string newFilePath = "~/FileUpLoad/Book/" + bookModel.BookNo;
           if (!Directory.Exists(Server.MapPath(filePath)))
           {
               System.IO.Directory.CreateDirectory(Server.MapPath(filePath));
           }
           if (Directory.Exists(Server.MapPath(newFilePath)))
           {
               System.IO.Directory.Delete(Server.MapPath(filePath));
           }
           //修改文件夹名称
           System.IO.Directory.Move(Server.MapPath(filePath), Server.MapPath(newFilePath));
           #endregion