Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!mimsy!oddjob!uwvax!rutgers!mit-eddie!uw-beaver!tektronix!cae780!amdcad!lll-crg!lll-lcc!unisoft!greywolf
From: greywolf@unisoft.UUCP (Roan Jon Anderson)
Newsgroups: comp.unix.wizards
Subject: Re: stupidity in directory management?
Message-ID: <458@unisoft.UUCP>
Date: Tue, 21-Jul-87 17:07:30 EDT
Article-I.D.: unisoft.458
Posted: Tue Jul 21 17:07:30 1987
Date-Received: Fri, 24-Jul-87 03:31:10 EDT
References: <603@nonvon.UUCP>
Reply-To: greywolf@unisoft.UUCP (The Grey Wolf)
Distribution: na
Organization: UniSoft Systems; Berkeley, CA
Lines: 55
Keywords: mv-ing dirs made a bit easier...
Summary: remkdir made simple...

Sender:unisoft!greywolf (The Grey Wolf)


In article <603@nonvon.UUCP> mc68020@nonvon.UUCP (root) writes:
>
>   I am frustrated as all hell!  At least on the two versions of UNIX with
>which I have direct experience, the directory management is all fu**ed up!
>
>   After a file is removed, it's "slot" in the directory isn't re-used!  The
>damned directory keeps growing larger and LARGER.  To make matters worse,
>there appears to be no rational way to write a C program to "compact"
>the directory, leaving us with the highly undesirable chore of MVing
>everything OUT of the damned directory, rmdir'ing, re-mkdir'ing it, and
>moving everything back in again.  This wastes LOTS of time on the system,
>not to mention the operator/sysadmin's time.
>
>   QUERY:  Why this stupidity in the first place, and **WHY** hasn't 
>AT&T or BERSERKELEY ***DONE*** something to fix it???????  I mean really,
>it is a trivial matter to identify an rm-ed entry in a directory.  Either
>allow the directory management system to use the first available slot,
>creating a new slot only if necessary, or develop some mechanism for
>rationally compacting these messes from time to time.
>
>   Can those who are in positions of knowledge please explain, without
>condescension and rudery, what the story is here, please?  Am I mistaken
>about the way directories are arranged, about identifying rm-ed entries?
>
>    INformation, please!

------
Well, not sure about the actual re-use of a slot, but you only have to remove
one directory.
	Try this, and see how long it takes...it shouldn't take long...

#! /bin/sh -
while $# :; do
	/bin/mkdir foo
	/bin/mv $1/* $1/.??* foo
	/bin/rmdir $1
	/bin/mv foo $1
done



	The time it takes should be minimal, unless you have exceedingly large
directories, in which case it might take longer...

--------------------------------------------------------------------------------
Faster than pure assembly code...
	More powerful than kill -9...
		able to unmount busy file systems in a single call...
								 ______
	it's a (long) word...					/ |  | \
	it's a (back)plane...					\=#==#=/
								 \|  |/
				it's...				  \==/
								   \/
							SUPERUSER!!!!