/// summary /// 创建年月日文件 /// /summary /// param name="parPath"根目录/param private void CreateDir(string parPath) { string months = System.DateTime.Now.Month 10 ? "0" + System.DateTime.Now.Month.ToString() : System.DateTime.Now.Month
///
/// 创建年月日文件
///
/// 根目录
private void CreateDir(string parPath)
{
string months = System.DateTime.Now.Month
string dates = System.DateTime.Now.Day
DirectoryInfo dyear = new DirectoryInfo(parPath + System.DateTime.Now.Year.ToString());
DirectoryInfo dmonth = new DirectoryInfo(parPath + System.DateTime.Now.Year.ToString() + "//" + months);
DirectoryInfo ddate = new DirectoryInfo(parPath + System.DateTime.Now.Year.ToString() + "//" + months + "//" + dates);
if (!dyear.Exists)
{
dyear.Create();
dmonth = dyear.CreateSubdirectory(months);
ddate = dmonth.CreateSubdirectory(dates);
}
if (!dmonth.Exists)
{
dmonth.Create();
ddate = dmonth.CreateSubdirectory(dates);
}
if (!ddate.Exists)
{
ddate.Create();
}
}