I am new to Stack Overflow and am somewhat of a newbie with Linux. I have been trying to filter specific files within a parent directory and it's children using the following command as an example:
ls -R | grep '*.jpg' | wc -l
Which I have found great when looking for individual files but I will need to do this on a monthly basis and looking for quicker ways to list several types in one command. I purposely want to exclude hidden files.
I have tried this but to no avail — Count number of specific file type of a directory and its sub dir in mac
I've seen different methods across the web from list, find, tree, echo
etc. so any help with this would be much appreciated and if there is a better way of doing this than what I am currently doing then that's not a problem as I am open to suggestions. I'm just not sure what's the best way to skin this cat at the moment!
Thank you very much
you can do this with help of find
as it was mentioned under the link from your initial post.
Just something like this:
find . -name \*.jpg -or -name \*.png -not -path \*/\.\* | wc -l
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With