Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!gatech!bloom-beacon!husc6!mit-eddie!genrad!decvax!ucbvax!vax135!whb
From: whb@vax135.UUCP (Wilson H. Bent)
Newsgroups: comp.unix.wizards
Subject: Re: stupidity in directory management?
Message-ID: <1826@vax135.UUCP>
Date: Fri, 17-Jul-87 13:13:36 EDT
Article-I.D.: vax135.1826
Posted: Fri Jul 17 13:13:36 1987
Date-Received: Sat, 18-Jul-87 14:55:52 EDT
References: <603@nonvon.UUCP> <23047@sun.uucp>
Reply-To: whb@vax135.UUCP (Wilson H. Bent)
Distribution: na
Organization: Not Organized
Lines: 24
Summary: How/when does BSD shrink directories?

In article <23047@sun.uucp> guy%gorodish@Sun.COM (Guy Harris) writes:
>Now, if you fill up a directory with lots of files and then delete
>the files, in most versions of UNIX the directory will still be the
>same size, although most of the space will be free.  In 4.3BSD, the
>OS will shrink the directory file under certain circumstances.

Can someone go into more detail on this feature?  This is the first
time I've ever heard of any OS which was willing and able to compact
the directory.

The method I use to 'shrink' a directory with lost of unused slots
(either 4.2BSD or SysV) is to to the every-popular cpio move:
	cd (parent of jumbo)
	find jumbo -depth -print | cpio -pdlm teensy
	rm -r jumbo
	mv teensy jumbo		# just to get the names right!

Of course, I've yet to find a BSD find which understands "-depth"...
I don't usually do this, even on greatly dynamic directories such
as /usr/spool/lpr - the benifits aren't all that great.
-- 
Wilson H. Bent, Jr.		... ihnp4!hoh-2!whb
AT&T - Bell Laboratories	(201) 949-1277
Disclaimer: My company has not authorized me to issue a disclaimer.