Why use find? (Was: Can U pipe filenames to rm???)

Kim Christian Madsen kimcm at diku.dk
Sat Oct 6 00:58:25 AEST 1990


george at hls0.hls.oz (George Turczynski) writes:

>Our `find' (SunOS) supports the `-exec' option, and I assume this would be
>fairly common.  So, those of you without xargs, and who | a. can't,  b. don't
>want to | hack `find' use it like this:

>	find {{stuff here}} -exec rm -f {} \;

>Why use `xargs' when you don't need to ?

There are a lot of uses of xargs that are superior to using find with the
exec option. Find is *SLOW*, so if you have the names of files you want to
do something with in a file or pipe use xargs for performance.

Find is also complicated to use for non-trivial tasks, and the syntax  is
often confusing to non-wizards, so specialized shell-scripts or programs
are often more intuitive and faster to create and maintain.

All this is not to bash find(1), which is a wonderful, general tool, however
the multitude of UNIX tools gives you the choice of selecting the one,
most appropriate for your task and the one you're most familiar with.

						Kim Chr. Madsen



More information about the Comp.unix.shell mailing list