ftp/Connect.pl

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#///////////////////////////////////////////////////////////////////////////////////
#//
#// DownloadFile
#//
#// Purpose:
#//   Downloads a single file from one remote server to your local computer.
#//
#// Technical support: support@smartftp.com
#//
#///////////////////////////////////////////////////////////////////////////////////
use strict;
use Win32::OLE;
use Win32::OLE::Variant;
$| = 1;
 
package Test;
my $ftp = Win32::OLE->new('sfFTPLib.FTPConnectionMTA');
 
$ftp->{Host} = "ftp.smartftp.com";
$ftp->{Port} = 21;
$ftp->{Username} = "anonymous";
$ftp->{Password} = "test\@test.com";
$ftp->{Protocol} = 0; # FTP
 
$ftp->Connect();
print("Connected to server\n");
$ftp->ChangeDirectory("/SmartFTP");
print("ChangeDirectory() successful.\n");
$ftp->DownloadFile("License.txt", "License.txt", 0, 0);