Hi Everyone, I have a situation where I need to open a sftp connection, need to pull the file and have to verify receipt of local file after that have to rename the file in remote dir. For that, I wrote the following code. The code is giving the output given below and coming out of the program. But I could see the file in $logDir. Please let me know how I can fix the code.
open (FH, "|sftp [EMAIL PROTECTED]") or exception ("Unable to open the sftp: $!"); foreach my $filename (@files) { $localFile = makeFilePath( $logDir, $filename ); print( "Retrieving output file $filename" ); $remoteFile = makeFilePath($fileDir, $filename); print FH "get $remoteFile $logDir\n"; FH->autoflush(1) ; * die ( "Error retrieving output file: $localFile" ) if ( !-e $localFile);* # To Rename the file to file.old $oldFile = $remoteFile.".old"; print FH "rename $remoteFile $oldFile\n" or report "$!"; FH->autoflush(1); push @dataFiles, $localFile; } Output: Retrieving output file tissmAPI08220000.txt Error retrieving output file: /crdv8/logs/tissmAPI08220000.txt Pre-processing/data-mapping step reported failure on feed NAPI SM load sftp> Fetching /trading/tissmAPI08220000.txt to /crdv8/logs/tissmAPI08220000.txt sftp>