#!/usr/bin/perl -w
# Usage: ftp-cp SERVER PATH FILE...

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->cwd($dir) or die "Unable to change to $dir";
$ftp->binary or warn "Unable to set binary mode";
for (@ARGV) {
    $ftp->get($_) or die "Unable to retrieve $_";
}
