diff options
author | Sergej Pupykin | 2018-10-05 15:09:51 +0300 |
---|---|---|
committer | Sergej Pupykin | 2018-10-05 15:09:51 +0300 |
commit | e5b79a03f3cc0592951a6d6f374d17e91e4163b0 (patch) | |
tree | d4054c134f2d4697d8a0fbaadf4ce77e966fa4f8 /mirror.pl | |
download | aur-x-docs-pdf.tar.gz |
init
Diffstat (limited to 'mirror.pl')
-rw-r--r-- | mirror.pl | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/mirror.pl b/mirror.pl new file mode 100644 index 000000000000..8e14f8c000e8 --- /dev/null +++ b/mirror.pl @@ -0,0 +1,25 @@ +#!/usr/bin/perl -w + +sub http_list +{ + my $FH; + my ($baseurl, $url, $level) = @_; + open $FH, "wget -q $baseurl/$url -O -|" || die "wget error"; + + while(<$FH>) + { + if(/href="([\w.-]+\/)"/) + { + http_list($baseurl, $url.$1, $level+1); + } + elsif(/href="([\w.-]+\.pdf)"/) + { + system("mkdir -p $url"); + print "$baseurl$url$1\n"; + system("wget -c $baseurl$url$1 -O $url$1"); + } + } + close $FH; +} + +http_list("http://www.x.org/docs/", "", 0); |