#!/usr/bin/perl
ftpget
Simple script to get files off
of a remote server with ftp.
(c) 2000-2003 Hal Canary
License:
This is free software, see
http://www.gnu.org/licenses/gpl.txt
This product is distributed
WITHOUT ANY WARRANTY of any kind.
use Net::FTP;
if (($#ARGV eq 0) or ($ARGV[0] eq "")) {
print "\nusage:\n";
print " $0 USER HOSTNAME DIRECTORY FILE [MORE FILES]\n\n";
exit 1;
}
my ($login, $server, $directory, @files) = @ARGV;
my $pass = "";
if (! $pass) {
system "stty -echo";
print $login."@".$server."'s password: ";
chomp($pass = <STDIN>);
print "\n";
system "stty echo";
}
my $ftp = Net::FTP->new($server, Debug => 0)
or die "\n Unable to connect to $server! \n\n";
print "Connected to $server. \n";
$ftp->login($login,$pass)
or die "\n Incorect password! \n\n";
print "Logged in as $login. \n";
$ftp->cwd($directory);
print "Directory is $directory. \n\n";
for $x (@files) {
print " Getting $directory/$x ..." ;
$ftp->get($x);
print "done\n";
system( "/bin/ls -l $x");
}
print "Quitting...";
$ftp->quit;
print "\n";