你的位置:首页 > ASP.net教程

[ASP.net教程]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