c# 文件夾操作

Posted on 2015-07-29 16:11  qhy1277  阅读(266)  评论(0)    收藏  举报

 #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

博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3