Hi,
I am trying to run the following sub routine to copy a file from remote dir
to local. I am passing three arguments remote file, local file and the host
along with the user name. But, the program is not working. could somebody
please help me.
sub getFile {
my ( $rFile, $lFile, $rHost ) = @_;
my oldFile = $rFile.old;
open ( FH, "| sftp $rHost") or exception ( "Could not establish the sftp
connection");
print FH "get $rFile $lFile";
print FH "rename $rFile $oldFile";
print FH "exit";
close FH;
}
Thanks,
Rajeev Kilaru