From owner-freebsd-questions@FreeBSD.ORG Sat Nov 3 12:42:28 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 1563916A417 for ; Sat, 3 Nov 2007 12:42:28 +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 BBF9213C480 for ; Sat, 3 Nov 2007 12:42:27 +0000 (UTC) (envelope-from freebsd-questions@slightlystrange.org) Received: by catflap.slightlystrange.org (Postfix, from userid 106) id 845A061D4; Sat, 3 Nov 2007 12:41:53 +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 D7E86615F for ; Sat, 3 Nov 2007 12:41:52 +0000 (GMT) Received: (from danielby@localhost) by torus.slightlystrange.org (8.13.8/8.13.4/Submit) id lA3Cfpdj026192 for freebsd-questions@freebsd.org; Sat, 3 Nov 2007 12:41:51 GMT (envelope-from freebsd-questions@slightlystrange.org) Date: Sat, 3 Nov 2007 12:41:51 +0000 From: Daniel Bye To: FreeBSD Users Questions Message-ID: <20071103124151.GA3207@torus.slightlystrange.org> Mail-Followup-To: FreeBSD Users Questions References: <538619.51984.qm@web34408.mail.mud.yahoo.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="y0ulUmNC+osPPQO6" Content-Disposition: inline In-Reply-To: <538619.51984.qm@web34408.mail.mud.yahoo.com> 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:42:28 -0000 --y0ulUmNC+osPPQO6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 lik= e=20 > that bother me in the past. Heheh! You and many more, my friend, myself absolutely included! > 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. $ ls | wc -l 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 $ find /target/directory -type f -print | wc -l Dan --=20 Daniel Bye _ ASCII ribbon campaign ( ) - against HTML, vCards and X - proprietary attachments in e-mail / \ --y0ulUmNC+osPPQO6 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFHLGyPixf5fBYiFmoRAjUaAKDEhoxAsz/x2BU5Dpsuhrp+ddbFTQCfZQPd ZI8HHt31K0AxW8Qa9l8iRgA= =HBTp -----END PGP SIGNATURE----- --y0ulUmNC+osPPQO6--