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

Whoever 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 doesn’t even require any sign-in, The good thing is that it can accept your lovely nick name also and the URL is not mandatory too.
Thanks for your patience
~Krishna(I love "Transparency")

Popular Posts

Enter your email address:

Buffs ...

Tags


Powered by WidgetsForFree

Archives