#!/usr/bin/perl -w
use Net::FTP;
use CGI qw(-oldstyle_urls :standard);
use CGI::Carp qw(fatalsToBrowser);
use strict;
my $q = new CGI;
my $host="myhost";
my $dir = "/home/docs/test/";
my $login = "xyxyxy";
my $pw = "uyuyuy";
my $ftp = Net::FTP->new($host) or die "Cannot connect to $host: $@";
$ftp->login($login,$pw) or die "Cannot login to $host as $login: $@";
$ftp->cwd($dir) or die "Cannot change working directory: $@";
my @files=$ftp->dir or die or die "Cannot change working directory: $@";
foreach my $x_files(@files) {
$ftp->get($x_files, $x_files)
or die "Can't fetch $x_files: $!\n";
print "This is what I have now:::$x_files
\n";
}
$ftp->quit;h