Date: Tue, 06 Jul 2004 15:30:43 +0100 From: "Richard P. Williamson" <richard.williamson@u4eatech.com> To: "Steve Bertrand" <iaccounts@ibctech.ca>, questions@freebsd.org Subject: Re: Removing thousands of files using rm Message-ID: <6.1.1.1.2.20040706152727.027847e8@cygnus> In-Reply-To: <3703.209.167.16.15.1089123354.squirrel@209.167.16.15> References: <3703.209.167.16.15.1089123354.squirrel@209.167.16.15>
next in thread | previous in thread | raw e-mail | index | archive | help
At 15:15 06/07/2004. Steve Bertrand had this to say: >I often have the need to remove hundreds or even thousands of files from a >single directory (very often). Using rm, I usually get: > >pearl# rm -rvf * >/bin/rm: Argument list too long. > >Is there any way to work around this instead of having to select a small >bunch of files at a time to remove? find /path/to/dir -exec rm -rvf {} \; use /path/to/dir instead of cd /path/to/dir; find . ... because it is very easy to forget the cd /path/to/dir step. Doing find . -exec rm -rvf {} \; in, for example, / is Not Recommended(tm) Also, there is a space between the {} and the \;, don't skip it, as cryptic error messages result. man find for more info on what you can do with find. HTH, rip
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6.1.1.1.2.20040706152727.027847e8>