|
hier mal ein kleines beispiel mit perl geht lokal sehr schön .
Zitat: |
#!/bin/perl
use Net::FTP;
my $host = 'localhost';
my $user = 'thomas';
my $password = 'topsecret';
# Neues Net::FTP-Objekt
my $ftp = Net::FTP->new($host,
Timeout => 360,
Debug => 1
);
unless (defined $ftp) {
print "$@\n";
die "Can't create Net::FTP-Object\n";
}
$ftp->login($user,$password) || die "Can't login $!";
print "Aktuelles Verzeichnis des FTP-Servers: ", $ftp->pwd() , "\n";
my $file;
my $array_ref = $ftp->ls();
foreach $file (@$array_ref) {
# Transfermodus in Abhängigkeit von der Dateiendung setzen
if ($file =~ /(\.gif|\.jpg|\.tar|\.tar\.gz|\.tgz|\.zip)$/) {
$ftp->type(I);
} else {
$ftp->type(A);
} ## if else
$ftp->get($file) || next;
} ## foreach
$ftp->quit();
__END__
|
|
|