//E盘根目录创建以时间命名的文件夹,其中再建4个子文件夹
CString strTime = CTime::GetCurrentTime().Format("%Y%m%d");//获取当前时间
CString strPath = _T("E:\\" + strTime);//路径
if (!PathIsDirectory(strPath))//不存在则创建
{
CString strMsg = strPath + _T("不存在,是否创建?");
if (AfxMessageBox(strMsg, MB_YESNO) == IDYES)
{
CreateDirectory(strPath, NULL);//创建主文件夹
CString strPath1 = strPath + _T("\\up");
CString strPath2 = strPath + _T("\\down");
CString strPath3 = strPath + _T("\\left");
CString strPath4 = strPath + _T("\\right");
if (PathIsDirectory(strPath))//主文件夹存在,创建子文件夹
{
CreateDirectory(strPath1, NULL);
CreateDirectory(strPath2, NULL);
CreateDirectory(strPath3, NULL);
CreateDirectory(strPath4, NULL);
return;
}
}
}
return;