Translate This Page

About Me

profile_picture_120

Name: Joshua Lyon
Birthday: August 8, 1985
Location: Valley Ranch (Irving), TX
E-mail: josh@boshdirect.com

Related Articles

Content View Hits : 1137587
Shell command for recursive file count in folders
Written by Josh Lyon   
Friday, 07 August 2009 07:04

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 (1)

Write comment

smaller | bigger
security image
Write the displayed characters

busy