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 :
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!
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!