|
I am using perl to transfer file from a remote server to another using sftp. I'm not sure what it means, but we connect to the server using Expect. When the transfer is done (the transfer works fine), there is code to exit sftp. The exit, though, not only exits the sftp connection, but also stops the perl script. How can I exit the sftp connection, but still maintain the perl script? Also, what is the interact used for?
Here is some of the code:
my $expt = Expect->spawn("sftp ".$destination_ftp_username."\@".$destination_server);
$expt->send("$destination_ftp_password\n");
$expt->send("cd $destination\n");
$expt->send("put ".$rootdir.$tempdir.$fileinfo[1]."\n");
$expt->send("exit\n");
$expt->interact;
|