From owner-freebsd-questions@FreeBSD.ORG Sat Nov 3 12:50:01 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1DE1916A46C for ; Sat, 3 Nov 2007 12:50:01 +0000 (UTC) (envelope-from freebsd-questions@slightlystrange.org) Received: from catflap.slightlystrange.org (cpc5-cmbg1-0-0-cust497.cmbg.cable.ntl.com [86.6.1.242]) by mx1.freebsd.org (Postfix) with ESMTP id C120B13C4B2 for ; Sat, 3 Nov 2007 12:50:00 +0000 (UTC) (envelope-from freebsd-questions@slightlystrange.org) Received: by catflap.slightlystrange.org (Postfix, from userid 106) id 7EB85615F; Sat, 3 Nov 2007 12:49:34 +0000 (GMT) Received: from torus.slightlystrange.org (torus.slightlystrange.org [10.1.3.50]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by catflap.slightlystrange.org (Postfix) with ESMTP id E38046132 for ; Sat, 3 Nov 2007 12:49:33 +0000 (GMT) Received: (from danielby@localhost) by torus.slightlystrange.org (8.13.8/8.13.4/Submit) id lA3CnXSj028976 for freebsd-questions@freebsd.org; Sat, 3 Nov 2007 12:49:33 GMT (envelope-from freebsd-questions@slightlystrange.org) Date: Sat, 3 Nov 2007 12:49:33 +0000 From: Daniel Bye To: FreeBSD Users Questions Message-ID: <20071103124932.GB3207@torus.slightlystrange.org> Mail-Followup-To: FreeBSD Users Questions References: <538619.51984.qm@web34408.mail.mud.yahoo.com> <20071103124151.GA3207@torus.slightlystrange.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="H1spWtNR+x+ondvy" Content-Disposition: inline In-Reply-To: <20071103124151.GA3207@torus.slightlystrange.org> User-Agent: Mutt/1.4.2.3i X-PGP-Fingerprint: D349 B109 0EB8 2554 4D75 B79A 8B17 F97C 1622 166A Subject: Re: Determining the number of files in a directory X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Daniel Bye List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Nov 2007 12:50:01 -0000 --H1spWtNR+x+ondvy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Nov 03, 2007 at 12:41:51PM +0000, Daniel Bye wrote: > On Sat, Nov 03, 2007 at 05:27:06AM -0700, White Hat wrote: > > This is probably a dumb question; however, I never let a little thing l= ike=20 > > that bother me in the past. >=20 > Heheh! You and many more, my friend, myself absolutely included! >=20 > > Using FreeBSD-6.2 and Bash, how do I determine the number of files in a= =20 > > given directory? I have tried all sorts of combinations using different= =20 > > flags with the 'ls' command; however, none of them displays the number = of=20 > > files in the directory. >=20 > $ ls | wc -l >=20 > will show you how many files and directories in the current (target) > directory. To count just files, and exclude directories, you could try > something like >=20 > $ find /target/directory -type f -print | wc -l Except of course, that would descend into the subdirectories you're trying not to count... Sorry - an object lesson in not hitting send before you've tested what you scribbled. Dan --=20 Daniel Bye _ ASCII ribbon campaign ( ) - against HTML, vCards and X - proprietary attachments in e-mail / \ --H1spWtNR+x+ondvy Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFHLG5cixf5fBYiFmoRAjgRAKCgPBWDa3nhzuXhzaFs+XCIbpOMiQCfapv9 IEVQsRkzgKz3R91NdBrxC2k= =7xkF -----END PGP SIGNATURE----- --H1spWtNR+x+ondvy--