Number of files in a directory?

Bruce R Larson ires at kaspar.UUCP
Tue May 21 00:34:22 AEST 1991


>mikeh at fsd.cpsc.ucalgary.ca (Michael Hoffos) writes:
>>... how can you get the number of files that are in a directory?

In article < ... > cpcahil at virtech.uucp (Conor P. Cahill) writes:
>The following will always work:
>
>	for a single directory:		ls -a | wc -l

Because so many of us alias `ls' to things like `ls -xF' it's a good
idea to issue a full path name to `ls' in the command above.

	/bin/ls -a | wc -l

Don't forget that `.' and `..' are being counted.

Bruce
--
Bruce R. Larson
Integral Resources, Milton MA
Internet:  blarson at ires.com
Uucp:  ..!{world|uunet}!ires.com!blarson
-- 
Bruce R. Larson
Integral Resources, Milton MA
Internet:  blarson at ires.com
Uucp:  ..!{world|uunet}!ires.com!blarson



More information about the Comp.unix.questions mailing list