A potential problem with using xargs is that although it means only one execution of rm which bodes better performance, it also converts everything read in from the pipe into a single argument list
No, it doesn't. xargs is smart enough that it knows the system limits, and splits of the task into several processes if needed. That's the beauty of xargs.
$ find /opt/perl -print0 2> /dev/null | xargs -0 | wc -l
42
$
Split up into 42 calls to
/bin/echo (the default for
xargs). Note also the use of
-print0 and
-0, that eliminates problems with filenames containing whitespace.