整个文件夹的拷贝 void CopyFolder( LPCTSTR pszSrc, LPCTSTR pszDes )
来源:互联网 发布:旧版本windows.old 编辑:程序博客网 时间:2024/06/07 12:29
void CopyFolder( LPCTSTR pszSrc, LPCTSTR pszDes ){if ((pszSrc == NULL) || (pszDes == NULL)){return;}if (_stricmp(pszSrc, pszDes) == 0){return;}CString strSrcFilePath = pszSrc;strSrcFilePath += _T("\\*.*");if (!PathFileExists(pszDes)){CreateDirectoryFromPath(pszDes);}CString strDesFilePath = pszDes;strDesFilePath += _T("\\");CFileFind finder;BOOL bWorking = finder.FindFile(strSrcFilePath);while (bWorking){bWorking = finder.FindNextFile();if (finder.IsDots()){continue;}if (finder.IsDirectory()){CString strDesSubPath = strDesFilePath;strDesSubPath += finder.GetFileTitle();CString strSrcSubPath = finder.GetFilePath();if (_stricmp(strSrcSubPath, pszDes) != 0){CopyFolder(strSrcSubPath, strDesSubPath);}else // des is src sub folder{continue;}}else{CString strNewFileName = strDesFilePath;strNewFileName += finder.GetFileName();CopyFile(finder.GetFilePath(), strNewFileName, FALSE);}}}BOOL CreateDirectoryFromPath( LPCTSTR pszPath ){if (pszPath == NULL){return FALSE;}int nLen = strlen(pszPath);char szPath[_MAX_PATH];for (int i=0; i<nLen; ++i){if ((pszPath[i] == '\\') || pszPath[i] == '/'){szPath[i] = '\0';if (!PathFileExists(szPath)){CreateDirectory(szPath, 0);}}else if ((pszPath[i] == ':')) // C:\aaa\aaa{szPath[i] = pszPath[i];if ((i+1) < nLen){i++;szPath[i] = pszPath[i];continue;}else return FALSE;}szPath[i] = pszPath[i];}if (!PathFileExists(pszPath)){CreateDirectory(pszPath, 0);}return TRUE;}
- 整个文件夹的拷贝 void CopyFolder( LPCTSTR pszSrc, LPCTSTR pszDes )
- LPCTSTR
- LPCTSTR
- LPCTSTR
- LPCTSTR
- LPCTSTR
- LPCTSTR
- LPCTSTR的用法
- LPCTSTR的含义
- vs2010 LPCTSTR 到 const char* 的转换 inet_addr LPCTSTR
- lpcstr与lpctstr的区别
- LPCTSTR和CString的关系
- LPCTSTR和CString的关系
- LPCTSTR和CString的关系
- LPCTSTR和CString的关系
- LPCTSTR和CString的关系
- LPCTSTR和CString的关系
- LPCSTR,LPCTSTR,LPCWSTR的区别
- exp和expdp怎么保证数据的一致性?
- 清理sybase 日志空间
- inux下创建sybase数据库
- HDU-1009 FatMouse' Trade
- CMake Introduction 2
- 整个文件夹的拷贝 void CopyFolder( LPCTSTR pszSrc, LPCTSTR pszDes )
- C#的switch语句
- java 2D 游戏教程
- C#的switch语句(2)
- Trixbox CE 安装手记
- GridView控件初步使用概括11.23
- AMBA总线介绍
- 关联关系的级联操作
- 简单XNA_Windows Phone 7 3D动画