- UID
- 77
- 精华
- 积分
- 9486
- 威望
- 点
- 宅币
- 个
- 贡献
- 次
- 宅之契约
- 份
- 最后登录
- 1970-1-1
- 在线时间
- 小时
|
删除文件夹:- void DeleteFolderA(char *szFilePath)
- {
- WIN32_FIND_DATAA fd;
- char szSearch[MAX_PATH]={0};
- strcpy(szSearch,szFilePath);
- strcat(szSearch,"*.*");
- HANDLE h=FindFirstFileA(szSearch,&fd);
- if(h!=INVALID_HANDLE_VALUE)
- {
- BOOL bRet=TRUE;
- while(bRet)
- {
- bRet=FindNextFileA(h,&fd);
- if(stricmp(fd.cFileName,".."))
- {
- char tmp[MAX_PATH]={0};
- strcpy(tmp,szFilePath);
- strcat(tmp,fd.cFileName);
- if(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
- {
- strcat(tmp,"\");
- DeleteFolder(tmp);
- }
- else
- {
- DeleteFileA(tmp);
- }
- }
- }
- FindClose(h);
- }
- RemoveDirectoryA(szFilePath);
- }
复制代码 测试:- DeleteFolderA("c:\\windows\");
复制代码 复制文件夹: |
|