LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-03-2006, 11:01 AM   #1
melissatoday
LQ Newbie
 
Registered: Jun 2006
Posts: 1

Rep: Reputation: 0
Question Count # of dir or # of files


Is there a way to count the number of dirs within a dir? I tried

ls -l -R

but that just gave way too much info. I just want the count without having to count, lol. Is there a way to do it with the # of files within the dir as well?

Thanks a bunch!!!
~perplexed in orlando
 
Old 06-03-2006, 11:03 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
just pipe the output to wc (word count)

find /home/bob | wc -l

to count the number of lines (and therefore number of files) found by the find command. also you could use "ls -1" to print a standard ls one file per line.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Recursively count lines of code in source dir heirarchy michaelsanford Programming 8 04-01-2006 04:59 PM
Q. moving /bin dir files to /dev dir?? Texas_student Linux - Software 2 03-26-2006 11:42 PM
count of files ? shendeswanand Linux - Software 3 01-23-2006 02:51 AM
how to get count of files in a directory? hongxing Linux - Software 2 11-10-2005 09:06 PM
how to count files disorderly Linux - Newbie 5 08-24-2004 01:36 PM


All times are GMT -5. The time now is 04:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration