84

How to count all files inside a folder, its subfolder and all . The count should not include folder count.

I want to do it in MAC

1

2 Answers 2

198

find . -type f | wc -l will recursively list all the files (-type f restricts to only files) in the current directory (replace . with your path). The output of this is piped into wc -l which will count the number of lines.

0
30

Find all files under myfolder and count them using wc. This works on linux:

find myfolder -type f | wc -l

Not the answer you're looking for? Browse other questions tagged or ask your own question.