[svlug] Re: [svlug]how to copy a bunch of "." files?

dfox@belvdere.vip.best.com dfox at belvdere.vip.best.com
Wed May 3 17:52:06 PDT 2000

> When using find, I see a lot of people using xargs when most of the time it
> isn't necessary. For example, the above find sequence can be written as:

On most Unices, one's command line buffer isn't all that long. It's
pretty long on Linux, as far as I know. When someone does a find, it
generates a list of filenames, which are then piped to the other processes.
Now, strictly in a case like this, xargs isn't necessary, since the
process will just take the filenames as they come, but generally, in
most situations, xargs is a safety net. Its nature is to take a few
filenames at a time, do the operation(s), and then get some more file-
names, and so forth.

Rather than using 'find', I typically use constructs involving back-
slashes, which take what's in between them, and substitute the output
right there in the command line. For instance:

rm `expr` rather than
find . <expr> -exec something {}; 

with or without xargs. In my opinion, the first is cleaner, but one
does run the risk of buffer overflow, if 'expr' evaluates to a very
very big list of files, e.g., on a very large subdirectory.
> >>>--fja->
David E. Fox                     Census         Thanks for letting me
dfox at belvdere.vip.best.com        2000          change magnetic patterns
Be Counted: http://www.census.gov               on your hard disk.

More information about the svlug mailing list