cleanup script needed

Mark Jeghers mark at motcsd.UUCP
Wed Mar 8 06:05:47 AEST 1989


In article <80 at torsqnt.UUCP> david at torsqnt.UUCP (David Haynes) writes:
>In article <9793 at smoke.BRL.MIL> gwyn at brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) writes:
>:In article <15659 at oberon.USC.EDU> rkumar at buddha.usc.edu () writes:
>:>Will rm -r *.dvi do the job?
>:
>:No, try	"find . -name '*.dvi' -print | xargs rm".
>:
>Why not, 	"find . -type f -name '*.dvi' -exec rm {} \;" 	?
>
>-david-


Becuase using "-exec rm {}" will invoke a "rm" process for each file found.
"xargs", on the other hand, will assemble as big of an argument list as
possible and invoke ONE "rm" process for that argument list.  "xargs" will
then start on another argument list and repeat the process until all the
file names being piped into it are used up.  This results in *much* fewer
invocations of "rm", and is thus more efficient.

Mark Jeghers
Motorola Computer Systems



More information about the Comp.unix.questions mailing list