Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 07 May 2000 16:50:57 -0700
From:      Doug Barton <DougB@gorean.org>
To:        Darren Wyn Rees <merlin@netlink.co.uk>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: "rm -rf *" - "argument list too long"
Message-ID:  <39160161.4BCFEFE3@gorean.org>
References:  <20000507201410.M540@netlink.co.uk>

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




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