void CopyFiles(char* SourPathFile,char* AimPathfile)
{
WIN32_FIND_DATA findData;
HANDLE hFindFile;
char SourPaths[MAX_PATH];
strcpy(SourPaths,SourPathFile);
strcat(SourPaths,"//*");
char AimPaths[MAX_PATH];
hFindFile=::FindFirstFile(SourPaths, &findData);
if(hFindFile!=INVALID_HANDLE_VALUE)
{
do
{
if(findData.cFileName[0]== '.')
{
continue;
}
strcpy(AimPaths,AimPathfile);//目标路径
strcat(AimPaths,findData.cFileName);
strcpy(SourPaths,SourPathFile);
strcat(SourPaths,findData.cFileName);
if(findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) //是文件夹
{
strcat(SourPaths,"//");
strcat(AimPaths,"//");
CreateDirectory(AimPaths,NULL);
CopyFiles(SourPaths,AimPaths );
}
else//是文件
{
FilesNum++;
CopyFile(SourPaths, AimPaths, true);
}
}while(::FindNextFile(hFindFile,&findData));
::FindClose(hFindFile);
}
else
{
printf(" %s /n", "can't open the file");
}
return ;
}