How to count number of files in each directory?

前端 未结 17 2729
小蘑菇
小蘑菇 2020-12-07 07:05

I am able to list all the directories by

find ./ -type d

I attempted to list the contents of each directory and count the number of files i

17条回答
  •  眼角桃花
    2020-12-07 08:05

    find . -type f -printf '%h\n' | sort | uniq -c

    gives for example:

      5 .
      4 ./aln
      5 ./aln/iq
      4 ./bs
      4 ./ft
      6 ./hot
    

提交回复
热议问题