c# 文件夾操作

Posted on 2015-07-29 16:11  qhy1277  阅读(265)  评论(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

Copyright © 2024 qhy1277
Powered by .NET 8.0 on Kubernetes