On Wed, 9 Feb 2005, Nilay   Puri, Noida wrote:

> I need to write a script 
> 1. to copy files from A server to B server.
> 2. after checking the non-existence of the files in 2 server.
> 
> How to do it through perl script ?
> 
> If I use ftp to copy files, is there any flag for mput whih will tell me if
> the file already exists in B server.
> Like, its asks for y/n flag on ftp prompt ?
> 
> Is there any other method to acheive the desired result  of moving files
> from A server to B server

If rsync over ssh is available, that's definitely the easiest approach:

  rsync --rsh=ssh --recursive --update remote:/file/path /file/path

  rsync --rsh=ssh --recursive --update /file/path remote:/file/path

And `rsync` provides dozens and dozens of ways to customize this. 
 
If web/http is available, you have all kinds of options for using web 
client tools; the simplest might be to use `wget --mirror ...`.

If these fail you, you can turn to Perl, but in this particular case, I 
think there are already excellent command line tools that solve the 
problem for you already, eliminating the need to write your own code.

 

-- 
Chris Devers

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to