Number of files in a directory

Unix command to count number of files in present folder


  • ls | wc -l
  • If your folder has directories and files, and you want to count only files, use the below.
ls -l | grep ^[^d] | wc -l
  • find ./ -type f | wc -l
  • ls -F | grep -v -e "/" -e "@" | wc -w
Note: This will show you number of files but not any directory or symbolic links in the  count.
  • If you would like to list out number of all the objects excluding directory then use
ls -F | grep -v "/" | wc -w


0 comments to "Number of files in a directory"

Post a Comment

Who ever writes Inappropriate/Vulgar comments to context, generally want to be anonymous …So I hope U r not the one like that?
For lazy logs u can at least use Name/URL option which don’t even require any sign-in, good thing is that it can accept your lovely nick name also and URL is not mandatory too.
Thanks for your patience
~Krishna(I love "Transparency")
వీలయితే నాల్గు పోస్టులు ...కుదురితే ఒక కామెంటూ ...

Translate

Enter your email address:

Buffs ...

Visitors


hits counter
View My StatsCheck Google Page Rank

Add to Google Reader or Homepage

Bookmark and Share

Tags


Powered by WidgetsForFree

Archives