[TriLUG] file and directory count

Tanner Lovelace lovelace at wayfarer.org
Thu Jul 31 16:36:07 EDT 2003


On Thu, 2003-07-31 at 16:28, Jason Tower wrote:
> ll|wc -l

Actually, this won't work at all.  I was first going to mention that
ll has to be defined as an alias (which, btw default it is for 
Red Hat and Mandrake and perhaps others), and then I was going to
mention that it wouldn't handle recursive counts at all, but then
I noticed that if you do an "ls -l" (which is what this is generally
aliased to), that it gives you a line at the top that is not a file
at all, so sorry Jason, this doesn't work.

The find recipes I posted, however, handle all the recursive 
cases correctly.  If you don't want to recurse, you can do this:

ls -1 | wc -l

By using -1 instead of -l (that's a one instead of a letter l) it
does not put the non-file line at the top (at least that I know of)
so it will give you a count of all the files in the current directory
only.

Cheers,
Tanner
-- 
Tanner Lovelace | lovelace(at)wayfarer.org | http://wtl.wayfarer.org/
--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--
GPG Fingerprint = A66C 8660 924F 5F8C 71DA  BDD0 CE09 4F8E DE76 39D4
GPG Key can be found at http://wtl.wayfarer.org/lovelace.gpg.asc
--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--
"What is this talk of "release?"  We do not make software "releases."  
Our software "escapes" leaving a bloody trail of designers and quality 
assurance people in its wake." - MoncriefJM at gvl.esys.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://www.trilug.org/pipermail/trilug/attachments/20030731/962a88ae/attachment.pgp>


More information about the TriLUG mailing list