Finiding count of files using C language using sytem calls with specific extension : Using bash I can find count the count of specific extensions of a file like jpg,mp4 etc..,. How can I achieve this using C language system calls? Any help to achieve this using C language system calls?

    ls -lR /path/to/dir/*.jpg | wc -l