M
mike
Hi,
I connect to a remote ftp site:
I see the following from the script:
Directory is /mirror/eclipse/technology/epp/downloads/release/galileo/
SR2
I cannot list the files in the directory $current_dir.
The line that fails is:
my @files=$ftp -> ls("$current_dir") or die "Could not list files. $!
\n";
Any idea what I am doing wrong? All help is very much appreciated.
//mike
Code:
use strict;
use warnings;
use Net::FTP;
my $message;
my $hostname ="ftp.ing.umu.se";
my $remote_dir = "/mirror/eclipse/technology/epp/downloads/release/
galileo/SR2/";
my $ftp = Net::FTP -> new ($hostname,Timeout => 30,Debug => 0) or
die "Cannot access $hostname via FTP\n";
$ftp -> login("anonymous",'-anonymous@') or
die "Invalid user name and/or password\n",$ftp-> $message;
$ftp->binary();
$ftp->cwd("$remote_dir") or die "Couldn't change directory. $!", $ftp->
$message;
my $current_dir = $ftp -> pwd();
print ("Directory is $current_dir \n");
my @files=$ftp -> ls("$current_dir") or die "Could not list files. $!
\n";
foreach my $file (@files){
print "$file \n";
}
I connect to a remote ftp site:
I see the following from the script:
Directory is /mirror/eclipse/technology/epp/downloads/release/galileo/
SR2
I cannot list the files in the directory $current_dir.
The line that fails is:
my @files=$ftp -> ls("$current_dir") or die "Could not list files. $!
\n";
Any idea what I am doing wrong? All help is very much appreciated.
//mike
Code:
use strict;
use warnings;
use Net::FTP;
my $message;
my $hostname ="ftp.ing.umu.se";
my $remote_dir = "/mirror/eclipse/technology/epp/downloads/release/
galileo/SR2/";
my $ftp = Net::FTP -> new ($hostname,Timeout => 30,Debug => 0) or
die "Cannot access $hostname via FTP\n";
$ftp -> login("anonymous",'-anonymous@') or
die "Invalid user name and/or password\n",$ftp-> $message;
$ftp->binary();
$ftp->cwd("$remote_dir") or die "Couldn't change directory. $!", $ftp->
$message;
my $current_dir = $ftp -> pwd();
print ("Directory is $current_dir \n");
my @files=$ftp -> ls("$current_dir") or die "Could not list files. $!
\n";
foreach my $file (@files){
print "$file \n";
}