C++文件夹深度拷贝问题

void CopyFiles(const CString &strSrcPath, const CString &strDstPath)
{
	SHFILEOPSTRUCT fops;
	TCHAR source[MAX_PATH] = { 0 };
	_tcscpy(source, strSrcPath);  // 源文件夹
	TCHAR dest[MAX_PATH] = { 0 };
	_tcscpy(dest, strDstPath);   // 目标文件夹
	fops.hwnd = ::GetActiveWindow();
	fops.wFunc = FO_COPY;
	fops.pFrom = source;
	fops.pTo = dest;
	fops.fFlags = FOF_NOCONFIRMATION | FOF_NOCONFIRMMKDIR || FOF_SILENT;
	fops.hNameMappings = NULL;
	fops.lpszProgressTitle = NULL;

	int result = ::SHFileOperation(&fops);
}

注意文件路径中不能带有“\\”、“\\\”等连续的多个反斜杠,那样是读取不出来的

上一篇:网络对抗-实验一


下一篇:leetcode刷题笔记324题 摆动排序 II