![]() |
How to count all files inside a folder, its subfolder and all
How to count all files inside a folder, its subfolder and all . The count should not include folder count
I have a really deep directory tree on my Linux box. I would like to count all of the files in that path, including all of the subdirectories. For instance, given this directory tree: /home/blue /home/red /home/dir/green /home/dir/yellow /home/otherDir/ |
find . -type f | wc -l
Explanation: find . -type f finds all files ( -type f ) in this ( . ) directory and in all sub directories, the filenames are then printed to standard out one per line. This is then piped | into wc (word count) the -l option tells wc to only count lines of its input. Together they count all your files. |
Find all files under home and count them using wc. This works on linux:
find home -type f | wc -l |
| All times are GMT +8. The time now is 04:06 AM. |
Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.