I have a loop I am running to retrieve some files over SFTP. The issue is
that I have a 'get or die' statement and both parts are executing one after
each other. I know it is getting the file because I checked the download
directory and I know the loop is only executing once because of the
filename print statement. The get retrieves the whole file and then the die
occurs. Why?! Is it something really simple that I missed because I have
been looking at this too long?

Any help is greatly appreciated,

Jeff.

 Here is snip of code the offending code. @list contains a list of hash
references from an ls() statement.

<snip>
foreach $item (@list)
{
    $item = $item->{filename};
    print "Item: $item\n";

    $sftp->get("./full_path/to_remote_dir/$item",
"/full_path/to_local_dir/$item") or die "$time Can't fetch $item: $@";

}
</snip>

Short Output (debug off):
Item: test.txt
Thu Sep 30 12:53:38 2004 Can't fetch test.txt:  at check.pl line 42.

Output (from sftp connect with debug output):
linux: sftp: Sending SSH2_FXP_INIT
linux: sftp: Remote version: 3
linux: sftp: Sent message T:11 I:0
linux: sftp: Sent message T:12 I:1
linux: sftp: Received reply T:104 I:1
linux: sftp: Received 8 SSH2_FXP_NAME responses
linux: sftp: Sent message T:12 I:2
linux: sftp: Received reply T:101 I:2
linux: sftp: Received SSH2_FXP_STATUS 1
linux: sftp: Sent message T:4 I:3
Item: test.txt
linux: sftp: Sent message T:17 I:4
linux: sftp: Received stat reply T:105 I:4
linux: sftp: Sent SSH2_FXP_OPEN I:5 P:./full_path/to_remote_dir/test.txt
linux: sftp: Sent message SSH2_FXP_READ I:6 O:0
linux: sftp: Received reply T:103 I:6
linux: sftp: In read loop, got 8192 offset 0
linux: sftp: Sent message SSH2_FXP_READ I:7 O:8192
linux: channel 1: window 15328 sent adjust 17440
linux: sftp: Received reply T:103 I:7
linux: sftp: In read loop, got 8192 offset 8192
linux: sftp: Sent message SSH2_FXP_READ I:8 O:16384
linux: sftp: Received reply T:103 I:8
linux: sftp: In read loop, got 8192 offset 16384
linux: sftp: Sent message SSH2_FXP_READ I:9 O:24576
linux: channel 1: window 16358 sent adjust 16410
linux: sftp: Received reply T:103 I:9
linux: sftp: In read loop, got 8192 offset 24576
linux: sftp: Sent message SSH2_FXP_READ I:10 O:32768
linux: sftp: Received reply T:103 I:10
linux: sftp: In read loop, got 8192 offset 32768
linux: sftp: Sent message SSH2_FXP_READ I:11 O:40960
linux: channel 1: window 16358 sent adjust 16410
linux: sftp: Received reply T:103 I:11
linux: sftp: In read loop, got 8192 offset 40960
linux: sftp: Sent message SSH2_FXP_READ I:12 O:49152
linux: sftp: Received reply T:103 I:12
linux: sftp: In read loop, got 565 offset 49152
linux: sftp: Sent message SSH2_FXP_READ I:13 O:49717
linux: sftp: Received reply T:101 I:13
linux: sftp: Sent message T:4 I:14
Thu Sep 30 12:53:38 2004 Can't fetch test.txt:  at check.pl line 42.
_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to