[vox-tech] Bash scripting newbie - need syntax help

Dave Margolis vox-tech@lists.lugod.org
Wed, 28 Apr 2004 12:24:14 -0700


Bill Kendrick wrote:

>Say you had files "deleteme", "metoo" and "imouttahere"
>
>  find . -type f -exec rm {} \;
>
>would cause this to happen:
>
>  rm deleteme
>  rm metoo
>  rm imouttahere
>
>whereas the xargs method:
>
>  find . -type f | xargs rm
>
>would cause this:
>
>  rm deleteme metoo imouttahere
>
>
>A bit quicker; less process forking, yada-yada-yada.
>
great explaination, gracias.  is there ever a chance that the set of 
information piped off to xargs could become too big?

for example:

find . -type f -exec rm {} \;
    rm 1
    rm 2
    ...
    rm 6,000,000

vs.

find . -type f | xargs rm 
[where xargs has to push 6 million things at rm and things get whacky fast]

it seems (but i have no idea) that find would handle this one rm process at a time, and though handling it slower, would struggle though it better than xargs might with one huge data set.

just a thought.  most of my uses of find involve web directories with say 5-60 html files, so i doubt i'd ever create this scenario...