Quote:
Originally Posted by tuxdev
(Post 3942828)
POSIX find can do the same sort of things with -exec +
Code:
find /var/mkt -maxdepth 1 -name "*.txt" -exec cp "{}" /media/nfs +
In my experience xargs is almost always pointless because it's only really ever used with find, and -exec + gets the exact same effect as using xargs.
|
I wasn't aware of the "-exec +" but the above doesn't work for me.
From a quick test, it would seem that the command fails if '{}' isn't the last parameter on the command line passed to -exec (which makes sense if you read what the man-page says it does), so you'd still need to use the "-t" flag on the cp as I did with the xargs based solution I posted.
So, it would be.
Code:
find /var/mkt -maxdepth 1 -name "*.txt" -exec cp -t /media/nfs '{}' +
Anyway, I've learnt something new here so thanks for posting tuxdev. As ever there's always several ways of doing something on the shell command line. My gut feeling is that I still prefer the use of xargs, but that may just be a familiarity issue.
|