高分求c语言(不要c++,c++学习ing)如何批量更改文件夹名问题方法,菜鸟免进

来源:百度知道 编辑:UC知道 时间:2024/06/29 01:24:02
要求能将搜索计算机到的文件夹添加统一后缀名或称其为windows默认代码,从而更改文件夹功能,比如将文件夹名后加".{645ff040-5081-101b-9f08-00aa002f954e}",文件夹即成回收站,加".{2227A280-3AEA-1069-A2DE-08002B30309D}",即成网络打印机文件夹
注意文件夹名后加'.';

#include <stdio.h>
#include <string.h>
#include <windows.h>
#include <io.h>
#include <wchar.h>

int main(int argc, char **argv)
{
intptr_t fHandle;
char full_path[1024] = {0};
char file_name[24][1024] = {0};
char *cur_pos = full_path;
char tmp[1024] = {0};
char path_tmp[1024] = {0};
int nRet = 0;
int i = 0;
int j = 0;
struct _finddata_t info;

strcpy(full_path, "C:\\aaa");
strcpy(tmp, full_path);
strcat(tmp, "\\*");

fHandle = _findfirst(tmp, &info);
do{
if((strcmp(info.name, ".") != 0) &&
(strcmp(info.name, "..") != 0)&&
(info.attrib == 16)
)
{
sprintf(file_name[i], "%s\\%s",full_path, info.name);
i++;
}
nRet = _findnext(fHandle, &info);
}while(nRet == 0);

for(j=