1、创建一级目录
CATUnicodeString strFolderPath ="D:\\ImageShot"; //如果不存在创建文件夹 CString folderPath = strFolderPath.ConvertToChar(); if (!PathIsDirectory(folderPath)) { bool flag = ::CreateDirectory(folderPath, 0); if (flag==0) { cout<<"创建ImageShot文件夹失败"<<endl; ::MessageBox(NULL,CString("创建ImageShot文件夹失败"),_T("提示"),MB_OK|MB_ICONWARNING); } }
2、循环创建多级目录