From owner-freebsd-questions Sun May 7 16:51: 3 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 D6AC037B539 for ; Sun, 7 May 2000 16:51:00 -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 QAA61179; Sun, 7 May 2000 16:50:57 -0700 (PDT) (envelope-from DougB@gorean.org) Message-ID: <39160161.4BCFEFE3@gorean.org> Date: Sun, 07 May 2000 16:50:57 -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: Darren Wyn Rees Cc: freebsd-questions@freebsd.org Subject: Re: "rm -rf *" - "argument list too long" References: <20000507201410.M540@netlink.co.uk> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Darren Wyn Rees wrote: > > I'm in a directory with a tonne of files I wish to delete. > I type "rm -rf *", but it won't work, it gives "/bin/rm: Argument > list too long". So how can I delete these many files ? > > I can "cd ..", and then "rm -rf ", and that works. > > However, what if I didn't wish to remove directories. In that > case, what would I do to remove the files ? 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. 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