Batch Transfers in Perl

I've been using SmartFTP interactively for some time now. Now, I'd like to start writing batch transfers, preferably in Perl, but I'm having trouble getting started.

Now, let me confess that I'm not very fluent or current with _any_ of the languages which can use the FTP Library. (I'm fluent and/or up-to-date in several languages and have been programming for a long time, just not the ones you have chosen to support with the FTP Library.) I've chosen Perl because I once had a reasonable working knowledge of it.

My initial problem is with ChangeDirectory(). The command simply doesn't work and I can't find out why from the documentation. Here's my code:

use strict;
use Win32::OLE;
use Win32::OLE::Variant;
$| = 1;

package Test;
my $ftp = Win32::OLE->new('sfFTPLib.FTPConnectionMTA');

$ftp->{Host} = "";
$ftp->{Port} = 21;
$ftp->{Username} = "xxx";
$ftp->{Password} = "yyyyyyyy";
$ftp->{Passive} = 1;
$ftp->{MLST} = 1;
$ftp->{Protocol} = 0;

my $ret = $ftp->Connect();
if($ret == 0) {
print("Connected to server\n");
else {
print("Connect failed.\n");

if($ftp->ChangeDirectory("/css") == 0) {
print("ChangeDirectory() successful.\n");
else {
print("ChangeDirectory() failed.\n");
die "$0 exiting....\n";

if($ftp->DownloadFile("imported.css", "imported.css", 0, 0) == 0) {
print("DownloadFile() successful.\n");
else {
print("DownloadFile() failed.\n");
die "$0 exiting....\n";


There is definitely a css directory on this server. I've tried the ChangeDirectory() with "/css", "\css", and "css" but all of those fail.

It's quite possible that I'm not in the directory I think I'm in so I decided to try adding a ReadDirectory() before the ChangeDirectory(). The ReadDirectory() command worked, in the sense that it didn't take the die path but I'm not at all clear on how to display the contents of the Items property. I assume that I need to do something like a foreach loop and then just display the files that are in the current directory. That will help me figure out just where I am in the directory tree. From there, I can ChangeDirectory() and/or ChangeDirectoryUp() until I get to my css directory.

Can anyone help me? I can't for the life of me figure out where to find this information in the FTP Library documentation. Aside from the one brief Perl sample program, I can't find any other Perl examples.


hello ..

Set the LogFile property and then post the log file. But I think you have the path wrong. For technical support please purchase a license for our products.

Thank you.