/*
CString strSourcePath = source;//文件的原始路径
CString strDesPath = destination; //文件的目的路径
CString strFileName = searchStr; //文件名
*/
CString strSourcePath = "d:\\a";//文件的原始路径
CString strDesPath = "d:\\b"; //文件的目的路径
CString strFileName = "*.*"; //文件名
CFileFind filefinder;
CString strSearchPath = strSourcePath + "\\" + strFileName;//生成文件路径
CString filename;
BOOL bfind = filefinder.FindFile(strSearchPath);
CString SourcePath, DisPath;
while (bfind)
{
bfind = filefinder.FindNextFile();
filename = filefinder.GetFileName();
SourcePath = strSourcePath + "\\" + filename;
DisPath = strDesPath + "\\" + filename;
CopyFile((LPCSTR)SourcePath, (LPCSTR)DisPath, TRUE);
}
filefinder.Close();
MFC 文件复制
最新推荐文章于 2025-05-21 16:42:21 发布