Date: Sat, 3 Nov 2007 12:41:51 +0000 From: Daniel Bye <freebsd-questions@slightlystrange.org> To: FreeBSD Users Questions <freebsd-questions@freebsd.org> Subject: Re: Determining the number of files in a directory Message-ID: <20071103124151.GA3207@torus.slightlystrange.org> In-Reply-To: <538619.51984.qm@web34408.mail.mud.yahoo.com> References: <538619.51984.qm@web34408.mail.mud.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071103124151.GA3207>