Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How many files under the directory 1

Status
Not open for further replies.

thendal

Programmer
Aug 23, 2000
284
Hi all!

I am new to unix ....Can some on help me in counting how many .html files are there under my home directory ..
(including all the sub directories)

Thanks in advance
:)

 
I'm away from my Linux box, but if memory serves, 'find /home/yours -name *.html | wc -l' (with your $HOME of course) should tell you how many are there.

Then again, I'm new too and flub with the find command just about every time I use it, so...
 
my 2 cents....
the find command is correct but you will have to quote the *.html after the -name option.

stan

find /home/yours -name "*.html" | wc -l
 
ummm sorry you will also need a print option

find /home/yours -name "*.html" -print | wc -l
 
Thanks stanhubble and dumtech...
Yeah i had the quotes problem ......
what that "|wc -l" do.. ...
thank you very much...
 
For the record, I got the same results with or without the quotes, and with/without the -print.

Snipit from the man page:

wc - print the number of bytes, words, and lines in files

-l is the option to count lines
 
krischrist, yes you could, but the key part of the question was "including all the sub directories"

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top