goozbach at gurulabs.com
Tue Mar 8 16:58:33 MST 2005
Eric Jensen wrote:
> 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.
> Some day this find stuff will stick around in my brain long enough for
> me to stop asking questions like this here. man find just ends up
> confusing me even more. ;) Thanks again.
Derek Carter <goozbach at gurulabs.com>
GuruLabs <http://www.GuruLabs.com/> Your source for linux instruction.
More information about the PLUG