首页 > Windows开发 > 详细

转载---C# 递归创建文件夹

时间:2019-06-06 13:27:19      阅读:129      评论:0      收藏:0      [点我收藏+]
原博客地址:https://blog.csdn.net/xiao_rory/article/details/8058814

private
DirectoryInfo createImgFolder(string filefullpath) { DirectoryInfo dir = null; if (!File.Exists(filefullpath)) { //string dirpath = filefullpath.Substring(0, filefullpath.LastIndexOf(‘\\‘)); string[] pathes = filefullpath.Split(\\); if (pathes.Length > 1) { string path = pathes[0]; for (int i = 1; i < pathes.Length; i++) { path += "\\" + pathes[i]; if (!Directory.Exists(path)) { dir = Directory.CreateDirectory(path); } } } } return dir; }

运行:
参数:D:\workspace-mars\imgserver\IMGPATH\ImgFiles\20190531
技术分享图片

 

 

 

转载---C# 递归创建文件夹

原文:https://www.cnblogs.com/xlaxx/p/10984388.html

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