Articles

Print

Shell command for recursive file count in folders

Written by Joshua Lyon on .

See below for a great shell command to get a listing of the count of files in all the folders in the current directory and below. It will produce an output similar to the following which can then be manipulated in a data-processing application:

1  ./example/dir1 
256./example/dir2
3  ./example/dir3/dir4/dir5
10 ./example/dir3/dir4/dir6
67 ./example/dir3/dir4/dir7

Command:

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

Comments   

 
S Gladstone
0 #1 S Gladstone 2009-11-04 09:11
I tried to find a "Contact Us" email address on a site that you designed for Naamat Israel, but I did not find an email address on their site ..... am I blind, or are they backward ?

If one exists, please send it to me at:

Thanks,

Sandy
Quote | Report to administrator