Recursively counting files in a Linux directory

后端 未结 21 1085
既然无缘
既然无缘 2020-11-28 17:17

How can I recursively count files in a Linux directory?

I found this:

find DIR_NAME -type f ¦ wc -l

But when I run this it returns

21条回答
  •  旧巷少年郎
    2020-11-28 17:35

    There are many correct answers here. Here's another!

    find . -type f | sort | uniq -w 10 -c
    

    where . is the folder to look in and 10 is the number of characters by which to group the directory.

提交回复
热议问题