Source: Any directory tree with any number and type of files. Q: How many .jpg
or .jpg
and .png
(for example) are in each subdirectory?
How can I limit the code below for files with 1 or more specific extension(s)? Having trouble inserting the -type f -name "*.jpg*"
, for example.
for DIR in $(find . -maxdepth 99 -type d)
do
printf "%10d\t%s\n" $(find ${DIR}|wc -l) "${DIR}"
done
Desired output:
118 ./aaa
73 ./aaa/bbb
16 ./aaa/bbb/ccc
If more than one file types are counted, then their combined total number in each subdirectories should be displayed.
.jpg
and.png
?