On Feb 17, 2005, at 8:42 am, Ow Mun Heng wrote:
On Sat, 2005-01-15 at 08:10, Matt Wilson wrote:-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
daniel wrote:
| On January 14, 2005 01:19 pm, Boyd Stephen Smith Jr. wrote:
|
|>On Friday 14 January 2005 07:00 am, Ow Mun Heng <[EMAIL PROTECTED]>
| you could probably use:
|
| $ find . -type f -maxdepth 1 -name '*gentoo*' -print0 | \
| xargs -0 --replace mv "{}" /path/to/new/dir/
I'm always a little confused as to why people always jump to suggest the
use of xargs when find's -exec works perfectly well;
$ find . -type f -maxdepth 1 -name "*gentoo*" -exec mv "{}" /path/to/new/dir/ \;
Is there any particular reason why people would recommend using xargs over -exec?
I may not be correct, but reading through xargs and some other docs, suggest that there is a _limit_ on the # of arguments accepted on the CLI before it gets "too many arguments"
It can also be much faster - I use xargs in a script which finds all files in $MAILDIR/$JUNK newer than .bogofilter/wordlist.db and calls bogofilter with the "add to spam database" flags, then does the same thing in all non-junk directories, adding to the ham database.
Using `find -newerthan whatever -print0 | xargs -0 bogofilter -s -v -B ` completes in seconds a database rebuild (working upon thousands & thousands of messages) that takes over 40 minutes using `find -newerthan whatever -exec bogofilter -n -v -B \{} \;`.
I also believe that xargs saves problems with whitespace & quoting in the filename.
Stroller.
-- gentoo-user@gentoo.org mailing list