Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hplabs!hpda!motcsd!mark From: mark@motcsd.UUCP (Mark Jeghers) Newsgroups: comp.unix.questions Subject: Re: cleanup script needed Message-ID: <275@greek.UUCP> Date: 7 Mar 89 20:05:47 GMT References: <15659@oberon.USC.EDU> <9793@smoke.BRL.MIL> <80@torsqnt.UUCP> Reply-To: mark@greek.UUCP (Mark Jeghers) Organization: Motorola Computer Systems, Cupertino, CA. Lines: 21 In article <80@torsqnt.UUCP> david@torsqnt.UUCP (David Haynes) writes: >In article <9793@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) writes: >:In article <15659@oberon.USC.EDU> rkumar@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