use warnings;
use feature 'say';
use Net::FTP;
use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
my $ftp = Net::FTP->new('mirror.ufs.ac.za', Debug => 0, Passive => 1, BlockSize => 104857600);
$ftp->login('anonymouse', 'anon@nymo.use');
$ftp->binary;
$ftp->cwd('/applications/filezilla/FileZilla_Client/3.9.0.6/');
foreach my $line ($ftp->dir()) {
eval {
if ($line =~ /^(?
[\-ld])(?([\-r][\-w][\-xs]){3})\s+(?\d+)\s+(?\w+)\s+(?\w+)\s+(?\d+)\s+(?((?\w{3})\s+(?\d{1,2})\s+(?\d{1,2}):(?\d{2}))|((?\w{3})\s+(?\d{1,2})\s+(?\d{4})))\s+(?.+)$/) {
my %remote_file_info = %+;
if ($remote_file_info{dir} eq '-') {
if ($ftp->get($remote_file_info{name}, 'files/' . $remote_file_info{name})) {
} else {
die($ftp->message);
}
}
}
};
if ($@) {
say($@);
}
}
$ftp->quit;
undef($ftp);