当前位置:网站首页>C language recursive folder code
C language recursive folder code
2022-06-12 09:51:00 【Tody Guo】
#include <stdio.h>
#include <io.h>
#include <string.h>
void listall(char *path)
{
_finddata_t fileDir;
long lfDir;
char apath[1024];
sprintf_s(apath, 1024, "%s\\*.*", path);
if ((lfDir = _findfirst(apath, &fileDir)) == -1l)
printf("No file is found\n");
else {
do {
if(fileDir.attrib == _A_SUBDIR && strcmp(fileDir.name, ".")!=0 && strcmp(fileDir.name, "..") != 0){
sprintf_s(apath, 1024, "%s%s\\", path, fileDir.name);
listall(apath);
}else if (strcmp(fileDir.name, ".") != 0 && strcmp(fileDir.name, "..") != 0) {
printf("%s%s\n", path, fileDir.name);
}
} while (_findnext(lfDir, &fileDir) == 0);
}
_findclose(lfDir);
}
int main()
{
char dir[] = "D:\\";
listall(dir);
getchar();
return 0;
}
边栏推荐
- Common technical questions in functional test interview. Would you like to summarize them?
- 7-5 zhe zhe playing games
- Crazy temporary products: super low price, big scuffle and new hope
- Auto.js学习笔记5:autojs的UI界面基础篇1
- UEFI edkii programming learning
- QQ,微信能聊天都靠它(socket)?
- Reading notes of the fifth cultivation
- 哈希表的理论讲解
- 5 most common CEPH failure scenarios
- [cloud native] establishment of Eureka service registration
猜你喜欢
Database common interview questions are ready for you

电阻的作用有哪些?(超全)

【云原生】具体指什么呢---此文和大伙儿分享答案
What are the software testing requirements analysis methods? Let's have a look

使用Visual Studio 2017创建简单的窗口程序

【极术公开课预告】Arm最强MCU内核Cortex-M85处理器,全方位助力物联网创新(有抽奖)

优质好书助成长 猿辅导携四大出版社推荐“暑期好书”

III Regular expression to finite state automata: NFA to DFA

List of computer startup shortcut keys

Auto.js学习笔记7:js文件调用另一个js文件里的函数和变量,解决调用失败的各种问题
随机推荐
价值投资.
MySQL optimized slow log query
PandoraBox 使用防火墙规则定义非上网时间
7-4 网红点打卡攻略(dfs)
I Regular expression to finite state automata: regular expression to NFA
硬盘 SMART 检测参数详解
7-5 哲哲打游戏
MySQL index
Financial test interview questions to help you get the offer
ThreadLocal
7-13 地下迷宫探索(邻接表)
QQ,微信能聊天都靠它(socket)?
Share the basic knowledge of software testing and write something you don't know
002: what are the characteristics of the data lake
001:数据湖是什么?
《保护我们的数字遗产:DNA数据存储》白皮书发布
2026年中国软件定义存储市场容量将接近45.1亿美元
SAP Hana error message sys_ XSA authentication failed SQLSTATE - 28000
基于SSM实现水果商城批发平台
Auto.js学习笔记4:autojs打包后,大部分华为等大牌子手机无法安装?利用模拟器远程在autoPro里签名打包可以解决该问题。