ftp/Connect.pl

#///////////////////////////////////////////////////////////////////////////////////
#//
#// DownloadFile
#//
#// Purpose: 
#//   Downloads a single file from one remote server to your local computer.
#//
#// Technical support: support@smartftp.com
#//
#// Copyright (c) by SmartSoft Ltd.
#//
#///////////////////////////////////////////////////////////////////////////////////
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);