C# 根据时间创建文件夹

时间:2020-12-13 23:31:54
 string file = ((fileNameIndex)index).ToString();
if (!Directory.Exists(HttpContext.Current.Server.MapPath("~/admin/upload/") + ((fileNameIndex)index).ToString()))
Directory.Exists(HttpContext.Current.Server.MapPath("~/admin/upload/") + ((fileNameIndex)index).ToString()); if (!Directory.Exists(HttpContext.Current.Server.MapPath("~/admin/upload/") + file + "/" + DateTime.Now.ToString("yyyy")))
Directory.CreateDirectory(HttpContext.Current.Server.MapPath("~/admin/upload/") + file + "/" + DateTime.Now.ToString("yyyy")); if (!Directory.Exists(HttpContext.Current.Server.MapPath("~/admin/admin/upload/" + file + "/" + DateTime.Now.ToString("yyyy/MM"))))
Directory.CreateDirectory(HttpContext.Current.Server.MapPath("~/admin/upload/" + file + "/" + DateTime.Now.ToString("yyyy/MM"))); if (!Directory.Exists(HttpContext.Current.Server.MapPath("~/admin/upload/" + file + "/" + DateTime.Now.ToString("yyyy/MM/dd"))))
Directory.CreateDirectory(HttpContext.Current.Server.MapPath("~/admin/upload/" + file + "/" + DateTime.Now.ToString("yyyy/MM/dd"))); if (!Directory.Exists(HttpContext.Current.Server.MapPath("~/admin/upload/" + file + "/" + DateTime.Now.ToString("yyyy/MM/dd"))))
Directory.CreateDirectory(HttpContext.Current.Server.MapPath("~/admin/upload/" + file + "/" + DateTime.Now.ToString("yyyy/MM/dd"))); imgsrc = HttpContext.Current.Server.MapPath("~/admin/upload/" + file + "/" + DateTime.Now.ToString("yyyy/MM/dd/") + img);
imgsrc = "/admin/upload/" + file + "/" + DateTime.Now.ToString("yyyy/MM/dd/") + img;