asp.net判断服务器上的目录或文件是否存在!(实例)
// ======================================================= 【判断文件是否存在】
- if (System.IO.File.Exists("c:\\aaa.txt"))
- {
-
- }
// ======================================================= 【判断目录是否存在】
- if (System.IO.<span style="font-size: 14px; line-height: 26px; ">Directory</span>.Exists("c:\\aaa"))
- {
-
-
- }
// =========================================================
【创建删除等,网上找的,没测试】
- <span style="font-size: 14px; line-height: 26px; ">System.IO.Directory.CreateDirectory(Server.MapPath("file"));
- <span style="font-size: 14px; line-height: 26px; "> System.IO.Directory.Delete(Server.MapPath("file"),true);