static void GetFileNameFromDir(char * pDirPath)
{
DIR *dir=opendir(pDirPath);
if(dir==NULL){
printf("%s\n",strerror(errno));
return;
}
struct dirent *ent;
while((ent=readdir(dir))!=NULL){
if(strcmp(ent->d_name,".")==0||strcmp(ent->d_name,"..")==0){
continue;
}
struct stat st;
stat(ent->d_name,&st);
if(S_ISDIR(st.st_mode))
{
getFileName(ent->d_name);
}
else
{
printf("%s\n",ent->d_name);
}
}
closedir(dir);
}
文件系统扫描目录下的所有文件的接口
最新推荐文章于 2023-02-22 11:07:35 发布