BOOL CopyDirectoryAllFiles(CString srcDir,CString destDir )
{
if( srcDir.IsEmpty() || destDir.IsEmpty() )return FALSE;
CFileFind ff;
BOOL bFind = ff.FindFile(srcDir + _T("\\*"));
CString newFilePath;
while( bFind )
{
bFind = ff.FindNextFile();
if( !ff.IsDirectory() )
{
newFilePath = destDir + _T("\\");
newFilePath += ff.GetFileName();
if( !::CopyFile(ff.GetFilePath(),newFilePath,FALSE) )
return FALSE;
}
}
return TRUE;
}
BOOL CopyDirecotryName(CString srcDir,CString destDir)
{
if( srcDir.IsEmpty() || destDir.IsEmpty() )
{
return FALSE;
}
CFileFind ff;
BOOL bFind = ff.FindFile(srcDir+ _T("\\*"));
CString srcPath, destPath;
while( bFind )
{
bFind = ff.FindNextFile();
if( (ff.GetFileName() == _T(".") || ff.GetFileName() == _T("..")))
continue;
if( ff.IsDirectory())
{
destPath = destDir + _T("\\");
destPath += ff.GetFileName();
srcPath = ff.GetFilePath();
::CreateDirectory(destPath,NULL);
CopyDirectoryAllFiles(srcDir,destDir);
CopyDirecotryName(srcPath,destPath);
CopyDirectoryAllFiles(srcPath,destPath);
}
}
return TRUE;
}
{
if( srcDir.IsEmpty() || destDir.IsEmpty() )return FALSE;
CFileFind ff;
BOOL bFind = ff.FindFile(srcDir + _T("\\*"));
CString newFilePath;
while( bFind )
{
bFind = ff.FindNextFile();
if( !ff.IsDirectory() )
{
newFilePath = destDir + _T("\\");
newFilePath += ff.GetFileName();
if( !::CopyFile(ff.GetFilePath(),newFilePath,FALSE) )
return FALSE;
}
}
return TRUE;
}
BOOL CopyDirecotryName(CString srcDir,CString destDir)
{
if( srcDir.IsEmpty() || destDir.IsEmpty() )
{
return FALSE;
}
CFileFind ff;
BOOL bFind = ff.FindFile(srcDir+ _T("\\*"));
CString srcPath, destPath;
while( bFind )
{
bFind = ff.FindNextFile();
if( (ff.GetFileName() == _T(".") || ff.GetFileName() == _T("..")))
continue;
if( ff.IsDirectory())
{
destPath = destDir + _T("\\");
destPath += ff.GetFileName();
srcPath = ff.GetFilePath();
::CreateDirectory(destPath,NULL);
CopyDirectoryAllFiles(srcDir,destDir);
CopyDirecotryName(srcPath,destPath);
CopyDirectoryAllFiles(srcPath,destPath);
}
}
return TRUE;
}