Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Oct 1997 18:40:59 +0930
From:      Greg Lehey <grog@lemis.com>
To:        Gordon Henderson <gordon@drogon.net>
Cc:        Shawn Ramsey <shawn@luke.cpl.net>, questions@FreeBSD.ORG
Subject:   Re: deleted huge directory
Message-ID:  <19971023184059.53521@lemis.com>
In-Reply-To: <Pine.LNX.3.95.971023095452.14037D-100000@unicorn>; from Gordon Henderson on Thu, Oct 23, 1997 at 10:01:46AM %2B0100
References:  <19971023181950.01356@lemis.com> <Pine.LNX.3.95.971023095452.14037D-100000@unicorn>

index | next in thread | previous in thread | raw e-mail

On Thu, Oct 23, 1997 at 10:01:46AM +0100, Gordon Henderson wrote:
> On Thu, 23 Oct 1997, Greg Lehey wrote:
>
>> On Thu, Oct 23, 1997 at 09:39:55AM +0100, Gordon Henderson wrote:
>>> On Thu, 23 Oct 1997, Greg Lehey wrote:
>>>
>>>> On Wed, Oct 22, 1997 at 09:38:52PM -0700, Shawn Ramsey wrote:
>>>>> Does anyone have any suggestions for deleting a huge directory? The
>>>>> direcory is /var/news/spool/control/cancel. The directory is too large to
>>>>> even do a ls. If I try doing ls, it eats up all the avail. RAM(140+mb) and
>>>>> hangs. Anyone? I would try a wildcard, but I don't know what the filenames
>>>>> are. (This is a very large news server, and this directory has never been
>>>>> touch as far as I know.)
>>>>
>>>> Doesn't rm -rf work?  Otherwise you could try
>>>>
>>>>   find dir | xargs rm -rf
>>>
>>> I do the following to clear this from time to time
>>>
>>>   cd /var/news/spool/control
>>>   mv cancel cancel.old
>>>
>>> (then a new one gets created and news keeps on going)
>>>
>>>   cd cancel.old
>>>   ls -f > /var/tmp/cancel.rm
>>>   xargs rm -f < /var/tmp/cancel.rm
>>
>> This is unnecessarily complicated.  Together, they're approximately
>> the same as what I suggested above.  You certainly don't need to store
>> the output of ls in a file.
>
> Find will try to sort the directory first before printing it - I belive
> it's the sort that causes the machine to run out of memory. 

Yes, this is a good point.

> And yes, it's probably true that you don't have to store it in a file, but
> I always wonder the wisdom of modifying the thing you are reading from!

You're not modifying anything.  Piping just moves the data from one
process to another.

Greg



home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19971023184059.53521>