/*以下代码实现从源目录按照目录层级将文件备份到目的地目录*/
#include "iostream"
#include "windows.h"
using namespace std;
void CopyFolder(char path[], char Destpath[],int level = 0)
{
char find_path[256];
char Dest_path[256];
char Dest_pathCopy[256];
char srcPath[256];
sprintf(find_path, "%s*", path);
sprintf(Dest_path, "%s", Destpath);
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
BOOL bContinue = TRUE;
hFind = FindFirstFile(find_path, &FindFileData);
if (hFind == INVALID_HANDLE_VALUE)
{
return;
}
while (bContinue)
{
if (stricmp(FindFileData.cFileName, "..") && stricmp(FindFileData.cFileName, "."))
{
for (int i = 0; i < level; ++i)
co