I changed to Net::SFTP::Foreign because of issues with Net::SFTP. I'm getting an error on my ::Foreign ->put() call. My code is able to connect, change directories, and get a directory listing, but when I do the put, it errors out.
I've stripped my code down to just this:
Here's the output with debugging turned on:
I am the only one ftp-ing to that directory and all I get on the remote server is a file of size 0. I can run sftp from the command line with the same user, password, remote directory, and file name and it works fine. Does anyone have any suggestions?Couldn't setstat remote file (fsetstat): The requested operation cannot be performed because there is a file transfer in progress.
I've stripped my code down to just this:
Code:
#!/usr/bin/perl -X
use Net::SFTP::Foreign;
use strict;
my $host = "host";
my $username = "user";
my $password = "passwd";
my $directory = "dir";
$Net::SFTP::Foreign::debug = 1;
my $sftp = Net::SFTP::Foreign->new( "$username\@$host", password => $password );
$sftp->setcwd( "$directory" );
my @files = $sftp->ls();
foreach my $f ( @files )
{
foreach my $file_ref ( @{$f} )
{
print "Found file: " . $file_ref->{'filename'} . "\n";
}
}
$sftp->put( "test_file.txt" => "test_file.txt" );
if ( $sftp->error )
{
print "Put error: " . $sftp->error . "\n";
print "Put status: " . $sftp->status . "\n";
}
Here's the output with debugging turned on:
=> perl test2.pl
# queueing msg len: 5, code:1, id:3 ... [1]
# waiting for message... [1]
# got it!, len:5, code:2, id:3, status: -
# queueing msg len: 15, code:16, id:0 ... [1]
# waiting for message... [1]
# got it!, len:63, code:104, id:0, status: -
# queueing msg len: 18, code:11, id:1 ... [1]
# waiting for message... [1]
# got it!, len:10, code:102, id:1, status: -
# queueing msg len: 10, code:12, id:2 ... [1]
# waiting for message... [1]
# got it!, len:665, code:104, id:2, status: -
# queueing msg len: 10, code:12, id:3 ... [1]
# waiting for message... [1]
# got it!, len:17, code:101, id:3, status: 1
# queueing msg len: 10, code:4, id:4 ... [1]
# waiting for message... [1]
# got it!, len:40, code:101, id:4, status: 0
Found file: .
Found file: ..
Found file: PL_20080313
Found file: ae50.sh
# queueing msg len: 42, code:3, id:5 ... [1]
# waiting for message... [1]
# got it!, len:10, code:102, id:5, status: -
# queueing msg len: 18, code:10, id:6 ... [1]
# waiting for message... [1]
# got it!, len:106, code:101, id:6, status: 3
# queueing msg len: 10, code:4, id:7 ... [1]
# waiting for message... [1]
# got it!, len:40, code:101, id:7, status: 0
Put error: Couldn't setstat remote file (fsetstat): The requested operation cannot be performed because there is a file transfer in progress.
Put status: The requested operation cannot be performed because there is a file transfer in progress.