Sunday, 30 December 2012

Linux count the number of the files in that directory and its subdirectories

count  the number of the files in that directory and its sub directories is:

ls -laR | grep -v ^[.dlt] | grep -v ^$ | wc -l

OR run either of  the below codes  :-

for t in files links directories; do echo `find . -maxdepth 1 -type ${t:0:1} | wc -l` $t; done 2> /dev/null


50 files
0 links
74 directories


for t in files links directories; do echo `find . -type ${t:0:1} | wc -l` $t; done 2>/dev/null

6781 files
0 links
814 directories


No comments:

Post a Comment