Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 07 May 2000 19:10:35 -0700
From:      Doug Barton <DougB@gorean.org>
To:        Steve Price <sprice@hiwaay.net>
Cc:        Darren Wyn Rees <merlin@netlink.co.uk>, freebsd-questions@FreeBSD.ORG
Subject:   Re: "rm -rf *" - "argument list too long"
Message-ID:  <3916221B.865C810B@gorean.org>
References:  <Pine.OSF.4.21.0005071911060.3613-100000@fly.HiWAAY.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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




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