I'm using Perl's Net::FTP to download some files. At the moment it is downloading only one file. I want to download
all PDF files. Can someone please show me how do I do that? Thanks.
Here's my code:
Code:
#!/usr/bin/env perl
use strict;
use warnings;
use sigtrap;
use diagnostics;
use Net::FTP;
my $host="192.168.25.25";
my $directory="report/marketing/outgoing/day";
my $username = "user";
my $password = "password";
my $filename = "file_1.pdf";
my $ftp = Net::FTP->new($host, Debug => 0)
or die "Cannot connect to marketing: $@";
$ftp->login($username,$password)
or die "Cannot login ", $ftp->message;
$ftp->cwd($directory)
or die "Cannot change working directory ", $ftp->message;
$ftp->get($filename)
or die "get failed ", $ftp->message;
$ftp->quit;