Hello,

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!


In reply to Net::SFTP::Foreign setstat Error on Put by csftpteam

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.