有没有复制文件夹的函数啊?
好像是没有的,建议你自己写一个递归函数吧,这样子是最好的解决方法。我可以给你一段代码先。需要#include "direct.h"
void CDlgChange::CopyFiles(CString strSource, CString strTarget)
{
CFileFind fFile;
//到指定的目录
_mkdir(strTarget);
_chdir(strSource);
//查找指定目录下的所有文件
BOOL b=fFile.FindFile("*.*");
while(b)
{
//查找下一个文件
b=fFile.FindNextFile();
//判断是否是文件夹
CString filename=fFile.GetFileName();
if (fFile.IsDirectory()&&!fFile.IsDots())
{
if(strSource+fFile.GetFileName()+"\\"!=strTarget)
CopyFiles(strSource+fFile.GetFileName()+"\\",strTarget+fFile.GetFileName()+"\\");
}
else
::CopyFile(strSource+fFile.GetFileName(),strTarget+fFile.GetFileName(),FALSE);
}
fFile.Close();
}
用dos命令不行吗?
system(),WinExec()
BOOL CopyFile(
LPCTSTR lpExistingFileName, // name of an existing file
LPCTSTR lpNewFileName, // name of new file
BOOL bFailIfExists // operation if file exists
);
自己写一个递归遍历目录中所有文件名,在调用CopyFile
SHFileOperation