Skip to content

Instantly share code, notes, and snippets.

@sestaton
Last active May 18, 2016 21:02
Show Gist options
  • Save sestaton/0bdbd3cb554bfa2ab02dd8426a024997 to your computer and use it in GitHub Desktop.
Save sestaton/0bdbd3cb554bfa2ab02dd8426a024997 to your computer and use it in GitHub Desktop.
get ncbi ftp listing
use strict;
use warnings;
use Net::FTP;
my $host = "ftp.ncbi.nlm.nih.gov";
my $wdir = "/genomes/refseq/";
my $ftp = Net::FTP->new($host, Passive => 1, Debug => 0)
or die "Cannot connect to $host: $@";
$ftp->login or die "Cannot login ", $ftp->message;
$ftp->cwd($wdir)
or die "Cannot change working directory ", $ftp->message;
my @list = $ftp->ls();
print scalar(@list);
$ftp->quit();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment