bedtime question : xargs

vu pham vu at sivell.com
Thu Apr 23 05:38:51 PDT 2009


Roger Oberholtzer wrote:
> On Wed, 2009-04-22 at 22:59 -0500, Vu Pham wrote:
>> Using xargs, how can I pipe the output ( of some command ) as the 
>> *first* parameter of some other command ?
>>
>> Here is my problem: I have various rpm files in a directory tree. I want 
>> to copy all of these files to a remote server using scp. What I am 
>> thinking is
>>
>> [oliver at xen2vm4 redhat]$ find . -name "*.rpm" 
>>
>> ./SRPMS/hello-1.0.0-2.src.rpm
>> ./SRPMS/hello-1.0.0-1.src.rpm
>> ./RPMS/i686/hello-1.0.0-2.i686.rpm
>> ./RPMS/i686/hello-1.0.0-1.i686.rpm
>>
>>
>> # find . -name "*.rpm" | xargs  scp  ???   root at remoteserver:
> 
> perhaps
> 
> 	find . -name \*.rpm | xargs scp {} root at remoteserver:
> 
>
Thanks, Roger, but I got the below error:

[oliver at xen2vm4 ~]$ find . -name \*.rpm | xargs scp {} root at xen2vm1:
./redhat/RPMS/i686/hello-1.0.0-1.i686.rpm: Not a directory




Vu




More information about the Linux-users mailing list