From owner-freebsd-questions Fri Dec 10 5:54:48 1999 Delivered-To: freebsd-questions@freebsd.org Received: from bingnet2.cc.binghamton.edu (bingnet2.cc.binghamton.edu [128.226.1.18]) by hub.freebsd.org (Postfix) with ESMTP id 8BAA714D32 for ; Fri, 10 Dec 1999 05:54:45 -0800 (PST) (envelope-from zzhang@cs.binghamton.edu) Received: from sol.cs.binghamton.edu (cs1-gw.cs.binghamton.edu [128.226.171.72]) by bingnet2.cc.binghamton.edu (8.9.3/8.9.3) with SMTP id IAA02037; Fri, 10 Dec 1999 08:53:12 -0500 (EST) Date: Fri, 10 Dec 1999 07:40:03 -0500 (EST) From: Zhihui Zhang To: Dan Nelson Cc: Ben Smithurst , cjclark@home.com, freebsd-questions@FreeBSD.ORG Subject: Re: hopefully three simple questions In-Reply-To: <19991209170557.A7362@dan.emsphone.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, 9 Dec 1999, Dan Nelson wrote: > 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. > Yes! If you do a rm * under a directory, the directory size remains the same until next time you do a lookup operation on it. It is a good point! -Zhihui To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message