Leser: 1
6 Einträge, 1 Seite |
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
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/perl
use strict;
use warnings;
use File::Copy;
use Net::FTP;
use Net::Netrc;
# change directory
chdir "/var/ftp/files" or die "/var/ftp/files: $!\n";
# DO NOT transfer without info file
-f "/home/ftp/files/info" or die "info file is missing\n";
open(FILE, "<info>");
while (<FILE> ) {
s/\W*$//;
next if (!$_);
/^(.+?) \s+ (.+?)$/x;
my ($old, $new) = ($1, $2);
rename $old, $new; # rename files
# ftp transfer
my $server = "X.X.X.X";
my $ftp = Net::FTP->new ($server, Timeout => 9000, Debug => 3);
$ftp or die "$server: cannot connect: $@";
# If you don't use ~/.netrc
$ftp->login ('anonymous', 'someone@mydomain') or
die "$_: cannot logon: " . $ftp->message;
$ftp->put ($2) or
die "$server: cannot put $2: " . $ftp->message;
sleep ( 5 * 60 )
}
1
2
3
4
5
$ftp = Net::FTP->new("some.host.name", Debug => 0);
$ftp->login("anonymous",'-anonymous@');
$ftp->cwd("/pub");
$ftp->get("that.file", "that.file.remotecopy");
$ftp->quit;
6 Einträge, 1 Seite |