Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!crdgw1!uunet!world!kaspar!ires From: ires@kaspar.UUCP (Bruce R Larson) Newsgroups: comp.unix.questions Subject: Re: Number of files in a directory? Summary: use full path name for ls Message-ID: <116@kaspar.UUCP> Date: 20 May 91 14:34:22 GMT References: <1991May19.034308.9149@cpsc.ucalgary.ca> <1991May19.111727.18637@virtech.uucp> Organization: Integral Resources, Milton, MA Lines: 26 >mikeh@fsd.cpsc.ucalgary.ca (Michael Hoffos) writes: >>... how can you get the number of files that are in a directory? In article < ... > cpcahil@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@ires.com Uucp: ..!{world|uunet}!ires.com!blarson -- Bruce R. Larson Integral Resources, Milton MA Internet: blarson@ires.com Uucp: ..!{world|uunet}!ires.com!blarson