Tricky Deleting

Doran Barton fozz at iodynamics.com
Tue Mar 8 19:34:52 MST 2005


Not long ago, Derek Carter proclaimed...
> Eric Jensen wrote:
> 
> ><snip>
> >Quick question, what is the difference of doing something like:
> >
> >`find stuff | rm -rf ` and `find stuff | xargs rm -rf `?
> 
> find stuff | rm -rf  -- this command will generate a list of all 'found' 
> files and send that to STDIN of the rm command, the rm command will 
> erase all file paths sent to it from STDIN.
> 
> find stuff | xargs rm -rf  -- this command will generate a list of all 
> 'found files and send that list to the xargs command which takes that 
> list and runs the command
> supplied with each member of the list (eg rm -rf stuff1, rm -rf stuff2)
> 
> so the biggest difference is the number of rm processes you're creating, 
> one for the first command that deletes all the files, and one for each 
> 'found' file with the second.

So what about 'find stuff -exec rm {} \;'? 

-=Fozz

-- 
fozz at iodynamics.com is Doran L. Barton, president, Iodynamics LLC
Iodynamics: Linux solutions - Web development - Business connectivity
 "Instructions: Open packet, eat nuts."
    -- Seen on an in-flight packet of nuts
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://plug.org/pipermail/plug/attachments/20050308/fa79dc58/attachment.bin 


More information about the PLUG mailing list