View Single Post

   
  #6 (permalink)  
Old 01-16-2008, 11:34 AM
steeles
 
Posts: n/a
Default Re: Scripting help - copying modified files to another server

find /home/dir -type f -exec scp {} serverB: \;

I tried, it, it acutally copy files into "/" in server B, not those files
supposed to be.


"Douglas O'Neal" <oneal@dbi.udel.edu> wrote in message
news:f7qcvb$1ih$1@scrotar.nss.udel.edu...
> steeles wrote:
>> Thanks.
>>
>> rsync is an open source tool similar to rcp
>>
>> Orignially I want to use "Find", but how can I copy those files into same
>> direcotry in sever B?
>>
>>
>> "CK" <claus@ultima-dragons.org> wrote in message
>> news:hrnv93lp64uji9k6ib0mh9fj15jnjqsln1@4ax.com...
>>> Words to the wise, "steeles" <steeles@gmail.com> wrote:
>>>
>>>> Need some help from scripting Guru.
>>>>
>>>> server A and B has the same directory structure, so I need to copy all
>>>> new
>>>> modified files to correstponding directory in Sever B.
>>>>
>>>> I can use "find" command to locate those file and direcotries into a
>>>> file,
>>>> but how can I copy over.
>>>>
>>>> I need some assisstance for this.
>>> First thing which comes to mind is setting up sftp
>>>
>>> - in batch mode
>>> - with ssh keys in order not to need authentification
>>>
>>> Second thing which comes to mind is using rsync.
>>> --
>>> Claus Dragon <clauskick@mpsahotmail.com>
>>> =(UDIC)=
>>> d++ e++ T--
>>> K1!2!3!456!7!S a27
>>> "Coffee is a mocker. So, I am going to mock."
>>>
>>> - Me, lately.

>>
>>

>
> Assuming you have it set up so that you can ssh from server A to
> server B without giving a password, you can use
>
> rsync --rsh=ssh --archive --delete /home/dir/ serverB:/home/dir
>
> The trailing slash on the first directory entry is necessary. This
> command will keep the directory structure on server B exactly like
> what is on server A. No daemons on B need to be started up other
> than sshd.
>
> If you still like find, you could use
>
> find /home/dir -type f -exec scp {} serverB: \;
>
> but you'll have to watch out for oddball characters in file names
> and new directories on A will not be created on B.
>
> Doug



Reply With Quote