csftpteam has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to put a file to an SFTP server using Net::SFTP::Foreign. When I try to put the file, it fails with this error:</p?
Couldn't setstat remote file (setstat)': File not found
Here is the code that I am using:
my $file_put = 0; foreach my $file (@file_globs){ foreach my $filepath (glob($local_dir.$file)) { next if (! -e $filepath); $filename = $filepath; #strip down file path to just get file name $filename =~ s/(.*\/)//; $sftp_connection->put($filepath, $remote_dir.$filename); if ($sftp_connection->error == 0){ &logEntry($args{'logfile'}, "$jobname--Putting remote file +: /".$remote_dir.$filename); $file_put = 1; } elsif ($sftp_connection->error != 0){ &logEntry($args{'logfile'}, "$jobname-ERROR: ".$sftp_conne +ction->error); } } }
$remote_dir is set to "/to_commerce/" and $filepath is set to "/secureftp/jobhome/vendor/file.txt"
Anyone have any ideas why this error would be getting thrown? Please let me know if you need more info
Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net::SFTP::Foreign setstat Error on Put
by Eliya (Vicar) on Dec 16, 2011 at 18:59 UTC | |
by csftpteam (Novice) on Dec 16, 2011 at 22:29 UTC |