Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- use Net::FTP;
- my $ftp_site = '193.54.74.20';
- my $ftp_dir = '/';
- my $ftp_user = 'anonymous';
- my $ftp_password = 'a_password';
- my $glob = '-la *';
- my @remote_files;
- 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: $!";
- $ftp->cwd($ftp_dir)
- or die "Could not change remote working " .
- "directory to $ftp_dir on $ftp_site";
- print "Saw:";
- @remote_files = $ftp->ls($glob);
- foreach my $file (@remote_files) {
- print "Saw: $file\n";
- }
- $ftp->quit();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement