4 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
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/perl
use strict;
use warnings;
use LWP::Simple;
use LWP::UserAgent;
my $ppmserverurl = "http://ppm.activestate.com/PPMPackages/zips/8xx-builds-only/Windows/";
my $ppmlocalfolder = "d:/ppm_mirror/";
die "[$ppmlocalfolder] does not exists." unless $ppmlocalfolder;
my $header = qq~<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<title>Index of /PPMPackages/zips/8xx-builds-only/Windows</title>
</head>
<body>
<h1>Index of /PPMPackages/zips/8xx-builds-only/Windows</h1>
<ul><li><a href="/PPMPackages/zips/8xx-builds-only/"> Parent Directory</a></li>~;
my $footer = qq~</ul>
</body></html>~;
my $page = get($ppmserverurl);
$page =~ s!^$header!!;
$page =~ s!$footer$!!;
my @lines = split /\r?\n/, $page;
my $ua = LWP::UserAgent->new(env_proxy => 1, keep_alive => 1, timeout => 30);
foreach my $line (@lines)
{
chomp $line;
next unless $line;
$line =~ m!<a href="(.*)"> (.*)</a>!i;
my ($file, $desc) = ($1, $2);
next unless $file and $desc;
my $source = "$ppmserverurl$file";
my $dest = "$ppmlocalfolder$file";
print "Mirror [$source] -> [$dest]\n";
$ua->mirror($source, $dest);
}
4 Einträge, 1 Seite |