Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Jul 2004 09:27:29 -0500
From:      "Andrew L. Gould" <algould@datawok.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: Removing thousands of files using rm
Message-ID:  <200407060927.29771.algould@datawok.com>
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
On Tuesday 06 July 2004 09:15 am, Steve Bertrand wrote:
> 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?
>
> The directory I am trying to remove the files from is always hot, so
> deleting the directory is unfortunately not an option. (I don't
> think).
>
> Any assistance is greatly appreciated.
>
> Tks all,
>
> Steve

You could always write a short script that reads and loops through the 
directory contents; and deletes one file (or a group of files) at a 
time.  It would take a little longer, but at least it would be 
automated.

Andrew Gould



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