/usr/bin/ftp-ls is in ncbi-entrez-direct 7.40.20170928+ds-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | #!/usr/bin/perl -w
# Usage: ftp-ls SERVER PATH
use strict;
use Net::FTP;
my $server = shift;
my $dir = shift;
my $ftp = new Net::FTP($server, Passive => 1)
or die "Unable to connect to FTP server: $!";
$ftp->login or die "Unable to log in to FTP server: ", $ftp->message;
$ftp->cwd($dir) or die "Unable to change to $dir: ", $ftp->message;
my $contents = $ftp->dir;
die "Unable to list contents" unless defined $contents;
for (@$contents) {
if (/^-.*?(\S*)$/) {
print "$1\n";
} elsif (/^d.*?(\S*)$/) {
print "$1/\n";
} elsif (/^l.*?(\S*) -> \S*$/) {
print "$1@\n";
}
}
|