Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

Tharg

Thank you so much, this has now worked.

I have struggled with getting perl's NET::FTPSSL working for some time, and finally found that the server I'm connecting to requires re-use of the data connection, which that library does not support.

Now it looks like, with WinSCP, I will be able to get everything working as I need it to. I made a donation - have a drink or a pizza on me.
martin

Re: Perl, ListDirectory, Can't see files

I'm not Perl expert.
But did you try to access the Files collection the way Transfers collection is accessed on this example:
https://winscp.net/eng/docs/library_perl#example

I.e.
my $directory = $session->ListDirectory("/20140506");

my $items = Win32::OLE::Enum->new($directory->{'Files'});
Tharg

Perl, ListDirectory, Can't see files

Hi -

My WWinscp is V 5.5.3 (in the client).

I have been trying to use it with Perl and ftps.

I don't have direct access to the server (for logs etc).

My perl script, so far (based on an example), is :

use strict;

use warnings;
 
use Win32::OLE;
use Win32::OLE::Const;
use Win32::OLE::Variant;
 
use Data::Dumper;

use constant
{
    TRUE  => Variant(VT_BOOL, 1),
    FALSE => Variant(VT_BOOL, 0)
};

my $Host   = 'REDACTED';
my $User   = 'REDACTED';
my $Password   = 'REDACTED';


my $session = Win32::OLE->new('WinSCP.Session');
 
# Load constants
my $consts = Win32::OLE::Const->Load($session);
 
# Setup session options
my $sessionOptions = Win32::OLE->new('WinSCP.SessionOptions');
 
$sessionOptions->{'Protocol'} = $consts->{'Protocol_Ftp'};
$sessionOptions->{'FtpSecure'} = $consts->{'FtpSecure_ExplicitSsl'};
$sessionOptions->{'FtpMode'} = $consts->{'FtpMode_Passive'};
$sessionOptions->{'HostName'} = $Host;
$sessionOptions->{'UserName'} = $User;
$sessionOptions->{'Password'} = $Password;
$sessionOptions->{'TransferMode'} = $consts->{'TransferMode_Binary'};
 
# Connect
$session->Open($sessionOptions);

my $Files = $session->ListDirectory("/20140506")->Files();

while ( defined( my $File = $Files->Next ) ){
   printf STDOUT ("%s\n", "..." );
   printf STDOUT ("%s\n", $File->Name );
   printf STDOUT ("%s\n", $File->Name() );
   printf STDOUT ("%s\n", $File->Length() );
}


And I never find any files. If I try to transfer a file on to the server instead, this works fine.

I'm afraid that although I'm reasonably good with Perl, I'm not in any way confident with using it in this way, with Win32::OLE etc. I don't know how to check for errors here or whatever.

I can connect using the WinSCP client and see file lists etc.

Thanks for any help!