Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!dsac.dla.mil!dsacg3.dsac.dla.mil!desc.dla.mil!wright!eve.wright.edu!spotter From: spotter@eve.wright.edu (Master Vampire) Newsgroups: comp.unix.questions Subject: Re: Number of files in a directory? Message-ID: <1991May21.002839.22984@eve.wright.edu> Date: 21 May 91 04:28:58 GMT References: <1991May19.034308.9149@cpsc.ucalgary.ca> <1991May19.111727.18637@virtech.uucp> <116@kaspar.UUCP> Organization: Wright State University Lines: 25 Nntp-Posting-Host: eve.wright.edu In article <116@kaspar.UUCP> ires@kaspar.UUCP (Bruce R Larson) writes: >>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. Well, to correct for '.' and '..', you can use /bin/ls -A | wc -l Or, at least, I assume '-A' will work on most system. It is supposed to list every file, except '.' and '..' Steve -- anagram@desire.wright.edu | "Role becomes the actor, she's addicted to applause spotter@eve.wright.edu | The stage a world because she never leaves it." | -Rush WSU doesn't approve of anything I do, but that hasn't stopped me yet.