Mailinglist Archive: opensuse (2459 mails)

< Previous Next >
Re: [opensuse] /bin/rm: Argument list too long
  • From: Randall R Schulz <rschulz@xxxxxxxxx>
  • Date: Wed, 26 Mar 2008 12:13:25 -0700
  • Message-id: <200803261213.25614.rschulz@xxxxxxxxx>
On Wednesday 26 March 2008 12:07, Nick Zeljkovic wrote:
How can I delete these files w/o removing the folder itself?

find .thumbnails -type f -exec rm -rf {} \;

This could be very slow, since there must be a fork / exec for each
file. Usually much faster is this:

% find dirName(s) {findCriteria} -print0 |xargs -0 rm

By doing this, xargs essentially "batches up" maximal (w.r.t. the
argument size limit) sets of file names and invokes rm only as many
times as necessary.

Note the use of find's -print0 option and the corresponding -0 option to
xargs. This causes each file name to be delineated by a NUL character
which means that files with spaces or other funky characters in their
names won't mess things up.

And no, it's not a bug.

Not at all, just a limit.

Nick Zeljkovic

Randall Schulz
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups