//strSrcPath="D:\zm\ModelShell\resource\*.*";
//strDestPath="C:\Users\Administrator\Desktop\WorkShell\101601\101601_00_rad";
//拷贝strSrcPath目录所有文件到指定strDestPath文件目录
int CFileTools::CopyFileToRad(CString strSrcPath, CString strDestPath)
{
TCHAR tszSrcPath[MAX_PATH] = { 0 };
TCHAR tszDestPath[MAX_PATH] = { 0 };
_sntprintf_s(tszSrcPath, MAX_PATH, _T("%s"), strSrcPath.GetBuffer(strSrcPath.GetLength()));
strSrcPath.ReleaseBuffer(strSrcPath.GetLength());
_sntprintf_s(tszDestPath, MAX_PATH, _T("%s"), strDestPath.GetBuffer(strDestPath.GetLength()));
strDestPath.ReleaseBuffer(strDestPath.GetLength());
SHFILEOPSTRUCT fop;
ZeroMemory(&fop, sizeof(fop));
fop.fFlags = FOF_NOCONFIRMATION | FOF_NOCONFIRMMKDIR /*| FOF_SILENT*/;
fop.fAnyOperationsAborted = FALSE;
fop.hNameMappings = NULL;
fop.lpszProgressTitle = NULL;
fop.wFunc = FO_COPY;
fop.pFrom = tszSrcPath; /*_T("E:\\mywww\\server\\mysql\\5.5\\*.*"); 路径不支持反斜杠*/
fop.pTo = tszDestPath; /*_T("E:\\mywww\\server\\test\\5.5"); 路径不支持反斜杠*/
int iRes = SHFileOperation(&fop);
if (iRes != 0)
{
CString strLog;
strLog.Format(_T("SHFileOperation 返回值 iRes=%d\n"), iRes);
OutputDebugString(strLog);
}
return iRes;
}