#!/usr/bin/perl
use strict;
use warnings;
use Net::FTP;
use File::Listing qw(parse_dir);
my $ftp_site = 'ipaddress';
my $ftp_user = 'ftpusername';
my $ftp_password = 'password';
my $ftp = Net::FTP->new($ftp_site)
or die "Could not connect to $ftp_site: $!";
$ftp->login($ftp_user, $ftp_password)
or die "Could not login to $ftp_site with user $ftp_user: $!";
print 'Remote directory is: ' . $ftp->pwd() . "\n";
my $ftp_dir=$ftp->pwd();
$ftp->cwd("/var/www/")or die "Could not change remote working \n";
print 'Current Working Directory is :'.$ftp->pwd()."\n";
my @remote_files = $ftp->ls()or die "Could Not Get List Of File \n";
foreach my $file (@remote_files) {
# if($ftp->get($file))
# {
print "Saw: $file :\n"; # has been downloaded Successfully\n";
# }
}
$ftp->quit();
use strict;
use warnings;
use Net::FTP;
use File::Listing qw(parse_dir);
my $ftp_site = 'ipaddress';
my $ftp_user = 'ftpusername';
my $ftp_password = 'password';
my $ftp = Net::FTP->new($ftp_site)
or die "Could not connect to $ftp_site: $!";
$ftp->login($ftp_user, $ftp_password)
or die "Could not login to $ftp_site with user $ftp_user: $!";
print 'Remote directory is: ' . $ftp->pwd() . "\n";
my $ftp_dir=$ftp->pwd();
$ftp->cwd("/var/www/")or die "Could not change remote working \n";
print 'Current Working Directory is :'.$ftp->pwd()."\n";
my @remote_files = $ftp->ls()or die "Could Not Get List Of File \n";
foreach my $file (@remote_files) {
# if($ftp->get($file))
# {
print "Saw: $file :\n"; # has been downloaded Successfully\n";
# }
}
$ftp->quit();