{I+=codeWee;}
[C++] MFC: Copy Folder - Sample Conde
void CreateFolder(CString sPath)
{
	int nPos = sPath.Find("\\", 3);
	while(nPos > -1)
	{
		CString sTempDir  = sPath.Left(nPos);
		_mkdir(sTempDir);
		if(sPath.GetLength() > nPos+1)
			nPos = sPath.Find("\\", nPos+1);
		else
			break;
	}
	if(sPath.GetAt(sPath.GetLength()-1) != '\\')
		_mkdir(sPath);
}

void CopyFolder(CString sSrcFolder, CString sDstFolder)
{
	if(sSrcFolder.IsEmpty()) return ;
	if(sDstFolder.IsEmpty()) return ;
	if(sSrcFolder.GetAt(sSrcFolder.GetLength()-1) != '\\') sSrcFolder += "\\";
	if(sDstFolder.GetAt(sDstFolder.GetLength()-1) != '\\') sDstFolder += "\\";
	CFileFind ff, ff2;
	BOOL bFind = ff.FindFile(sSrcFolder + "*");
	CString sDstPathName = "";
	while(bFind)
	{
		if(!ff2.FindFile(sDstFolder))
			CreateFolder(sDstFolder);
		bFind = ff.FindNextFile();
		if(ff.IsDirectory())
		{
			if(ff.GetFileName() != "." &&  ff.GetFileName() != "..")
				CopyFolder(ff.GetFilePath(), sDstFolder + ff.GetFileName());
		}
		else
		{
			CopyFile(ff.GetFilePath(), sDstFolder + ff.GetFileName(), TRUE);
		}
	}
}
HTML | PHP | C++ | DirectX11 | Javascript | C# | HTML5 | ASP | SQL | General | CSS | Oculus Rift | Unity3d | Virtools SDK | Tip | NSIS | PowerShell | node.js | Web API | RTSP | All
Copyright© 2016 CodeWee.com All rights reserved.