复制目录中的文件

时间:2015-05-08 11:41:34
【文件属性】:
文件名称:复制目录中的文件
文件大小:832B
文件格式:TXT
更新时间:2015-05-08 11:41:34
复制文件 复制某一给定目录下的文件 void FileCopyTo(CString source, CString destination, CString searchStr, BOOL cover = TRUE) { CString strSourcePath = source; CString strDesPath = destination; CString strFileName = searchStr; CFileFind filefinder; CString strSearchPath = strSourcePath + _T("\\*.*"); CString filename; BOOL bfind = filefinder.FindFile(strSearchPath); CString SourcePath, DisPath; while (bfind) { bfind = filefinder.FindNextFile(); if (filefinder.IsDots() || filefinder.IsSystem() || filefinder.IsHidde()||filefinder.IsDirectory()) continue; filename = filefinder.GetFileName();//获取文件名字 SourcePath = strSourcePath + "\\" + filename; //要复制文件名 DisPath = strDesPath + "\\" + filename; //复制后的文件名 ::CopyFile(SourcePath,DisPath,FALSE); //调用系统复制函数 }

网友评论