From owner-freebsd-questions Sun May 7 19:10:44 2000 Delivered-To: freebsd-questions@freebsd.org Received: from dt051n0b.san.rr.com (dt051n0b.san.rr.com [204.210.32.11]) by hub.freebsd.org (Postfix) with ESMTP id DCCD437B891 for ; Sun, 7 May 2000 19:10:40 -0700 (PDT) (envelope-from DougB@gorean.org) Received: from gorean.org (doug@master [10.0.0.2]) by dt051n0b.san.rr.com (8.9.3/8.9.3) with ESMTP id TAA61796; Sun, 7 May 2000 19:10:36 -0700 (PDT) (envelope-from DougB@gorean.org) Message-ID: <3916221B.865C810B@gorean.org> Date: Sun, 07 May 2000 19:10:35 -0700 From: Doug Barton Organization: Triborough Bridge & Tunnel Authority X-Mailer: Mozilla 4.72 [en] (X11; U; FreeBSD 5.0-CURRENT-0422 i386) X-Accept-Language: en MIME-Version: 1.0 To: Steve Price Cc: Darren Wyn Rees , freebsd-questions@FreeBSD.ORG Subject: Re: "rm -rf *" - "argument list too long" References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Steve Price wrote: > > On Sun, 7 May 2000, Doug Barton wrote: > > # First, ignore the overly complicated and potentially dangerous answers > # so far on this thread. :) Second, think about it for a minute. If "*" > # provides a list that's too long for rm to handle, why not break it up > # into smaller chunks? For example, if your files mainly have alpha > # characters in their names, do something like: > # > # rm [a-c]* > # > # Starting with larger chunks, and going smaller as needed till the error > # messages disappear. > > Something like this doesn't work? > > ls * | xargs rm > > Seems simple enough and should do it all in one pass. :) Most of the proposed solutions would work, but the ones like this suffer from having to spawn a new process for each file. Depending on how many files are in the directory, this could take a very long time (where "long time" is relative of course). A little shell manipulation goes a long way here. Doug -- "Live free or die" - State motto of my ancestral homeland, New Hampshire Do YOU Yahoo!? To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message