I am in the process of removing the Net::FTP routines in some of my
older programs. I don't yet have the Net::SFTP and Net::SSH::Perl
modules installed (I don't have root on these systems). In the
meantime, I will probably do:

system "scp remotehost:/remotedir/remotefile /localdir/localfile";
system "ssh remotehost 'rm /remotehost/remotefile' ";

I don't like doing things this way, because if I understand correctly,
it's hard to get things to fail nicely (or fail at all) if one of the
system commands is unsuccessful.

If, and when, the Net::SFTP and Net::SSH::Perl modules get installed,
I was planning on doing something like this:

use Net::SFTP;

Net::SFTP->new($remotehost)
            or die "could open connection to $remote_host\n";
$sftp->get($remotedir$remotefile)
            or die "could not get $remotefile\n";
$sftp->do_remove($remotedir$remotefile)
            or die "could not remove $remotedir$remotefile\n";

I am hoping that this is a sensible plan and that I've not overlooked
any serious weaknesses.

Thank you in advance for any comments and suggestions.

Don

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


Reply via email to