hi i use Qt and i want to know how much file are in a folder (include subfolder)
i find some code in internet but all of them only count file in a folder and not its subfolder
like this codes
#include <stdio.h>
#include <dirent.h>
int main(int argc, char *argv[])
{
    if(argc != 2)
    {
        printf("Usage: ./count \"<path>\"\n");
        return 1;
    }
    struct dirent *de;
    DIR *dir = opendir(argv[1]);
    if(!dir)
    {
        printf("opendir() failed! Does it exist?\n");
        return 1;
    }
    unsigned long count=0;
        while(de = readdir(dir))
     {
          ++count;
     }
    closedir(dir);
    printf("%lu\n", count);
    return 0;
}
i find this code here, it only count file in a folder and not its subfoler
anyone can help me
edit 1
i test this code from this page, it working but it can edit for less cpu usage?