From owner-freebsd-questions Thu Dec 9 15: 6: 7 1999 Delivered-To: freebsd-questions@freebsd.org Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by hub.freebsd.org (Postfix) with ESMTP id 2FE2214C8B for ; Thu, 9 Dec 1999 15:06:05 -0800 (PST) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.9.3/8.9.3) id RAA07507; Thu, 9 Dec 1999 17:05:57 -0600 (CST) (envelope-from dan) Date: Thu, 9 Dec 1999 17:05:57 -0600 From: Dan Nelson To: Zhihui Zhang Cc: Ben Smithurst , cjclark@home.com, freebsd-questions@FreeBSD.ORG Subject: Re: hopefully three simple questions Message-ID: <19991209170557.A7362@dan.emsphone.com> References: <19991209201115.B1271@strontium.scientia.demon.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: ; from "Zhihui Zhang" on Thu Dec 9 16:44:10 GMT 1999 X-OS: FreeBSD 4.0-CURRENT Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In the last episode (Dec 09), Zhihui Zhang said: > On Thu, 9 Dec 1999, Ben Smithurst wrote: > > Crist J. Clark wrote: > > > Zhihui Zhang wrote, > > > > > >> (2) How to find the largest directory in a filesystem? I mean > > >> the one with the maximum number of files in it. > > I have found a solution (hopefully correct): > > # find / -type d -ls | awd '{print $2, $11}' | sort -n | tail > > -Zhihui The "size" of the directory printed by 'find' does not always indicate how many files are in it. If you fill a directory with files and then delete every other file, it won't be able to compact out the empty slots. You'll have to walk the entire directory tree and count the files in each subdirectory, I'm afraid. -- Dan Nelson dnelson@emsphone.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message