Re: opening sftp command as a file



In article
<f366c2e20803300113l104b95e9l72e48df34e135bd1@xxxxxxxxxxxxxx>, Kilaru
Rajeev <kilarurajeev@xxxxxxxxx> wrote:

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;

The above line has several syntax errors in it.

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;
}

You should be posting a complete program that demonstrates the program.
Your program should have 'use strict;' and 'use warnings;' at the top.

The program above has syntax errors in it. You should cut-and-paste
your program instead of retyping it.

Please describe in what way the program "is not working".

Thanks.

--
Jim Gibson

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
.