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

原博客地址: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# 递归创建文件夹

 

 

 

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

上一篇:Android学习(二)—— Android SDK


下一篇:Windows上安装配置SSH教程(1)