Removing thousands of files using rm
Andrew L. Gould
algould at datawok.com
Tue Jul 6 07:26:21 PDT 2004
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
More information about the freebsd-questions
mailing list