I think it's best described with an example
parent1 (located inside /home/myuser
  - folder1
    - test11.png
    - test11.txt
    - folder11
      - test111.png
    - folder12
      - test121.png
      - test122.png
  - folder2
    - test21.png
if I can my script
get-number-of-files-per-folder "parent" png
the output should be:
folder1: 4
folder2: 1
at the moment, I'm using this command but it seems it counts all the files and not just the file extension I listed.
find /home/myuser/parent -maxdepth 1 -mindepth 1 -type d -exec sh -c 'echo "{} : $(find "{}" -iname "*png" -type f | wc -l)" file\(s\)' \;
How do I know it's wrong? because when I ran this
find /home/myuser/parent -iname '*jpg' -type f | wc -l
it says I have zero JPG files but the script above says I have xx files inside a folder.


-iname '*$png'doesn't match.pngfiles, right?findintowcorawk