1

how can I get the number of directories in a directory?

view story
linux-howto

http://stackoverflow.com – I am trying to get the number of directories in a folder except the files in but I cannot get the correct result. Somebody help me to solve this problem? Especially what should I sent to the isDirectory() function? int listFilesIndir(char *currDir) { struct dirent *direntp; DIR *dirp; int x ,y =0 ; if ((dirp = opendir(currDir)) == NULL) { perror ("Failed to open directory"); return 1; } while ((direntp = readdir(dirp)) != NULL) { printf("%s\n", direntp->d_name); x= isDirectory(dirp); if(x != 0) y++; (HowTos)