![]() |
|
|||||||
![]() |
|
|
Thread Tools | Display Modes |
|
#1
IP: 153.99.39.21
|
|||
|
|||
|
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/ |
|
#2
IP: 153.99.39.21
|
|||
|
|||
|
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. |
|
#3
IP: 153.99.39.21
|
|||
|
|||
|
Find all files under home and count them using wc. This works on linux:
find home -type f | wc -l |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|