首页 > Windows开发 > 详细

c#常用文件操作

时间:2021-01-05 15:02:02      阅读:15      评论:0      收藏:0      [点我收藏+]

c#常用文件操作

1.Web 获取绝对路径

string filePath = HttpContext.Current.Server.MapPath("~/EmailFiles/"+m.ms_username);

线程中:HttpRuntime.AppDomainAppPath.ToString();

From 

Application.StartupPath.ToString();

 

2.判断路径不存在 就 创建 if (!dir.Exists) dir.Create();

 

3.判断路径存在删除

if (Directory.Exists(thispath))
                        Directory.Delete(thispath + "\log",true);

//创建

Directory.CreateDirectory(thispath+"\log");

c#常用文件操作

原文:https://www.cnblogs.com/dennyw/p/14235148.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!