I was considering the following scenarios:

1.- 1 file match
2.- multiple file match
3.- Many files match (enough to generate a "File list too long" error)

After taking a more detailed read to how xargs works I noticed that xargs
will spawn the process (rm) as many times in order to actually avoid the
"File list too long" problem, didn't know that. Nice!  Definitely the xargs 
option is the best.

Regards,

Urivan A. Flores Saaib
CiberLinux Networking
Email: [EMAIL PROTECTED]
Web: www.ciberlinux.net


==============Original message text===============
On Mon, 12 Mar 2007 4:43:43 +0100 "John H. Robinson, IV" wrote:

Urivan Flores-Saaib wrote:
> > John H. Robinson, IV wrote
> >>find $HOME/.mozilla -name lock -print0 | xargs -0 rm
> 
> Why not:
> 
> find $HOME/.mozilla -name lock -exec rm {} \;

If there is exactly ONE lock file, then this is fine. If there are
multiple lock files, this forks off one rm for each file found. If there
are hundreds, well, you get the idea.

The xargs, while less efficient in the singluar case is far more
efficient in the multiple case.

For this instance, the -exec rm will be more efficient, as there is only
one file expected.

-john


-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list
===========End of original message text===========





-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to