third-party libs
This commit is contained in:
parent
f836927d3a
commit
b154ee9266
3667 changed files with 854591 additions and 0 deletions
67
third-party/curl-7.21.4/perl/contrib/recursiveftpget.pl.in
vendored
Normal file
67
third-party/curl-7.21.4/perl/contrib/recursiveftpget.pl.in
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
#!@PERL@
|
||||
#
|
||||
# Author: Daniel Stenberg <Daniel.Stenberg@sth.frontec.se>
|
||||
# Date: August 25 1998
|
||||
# Version: 0.1
|
||||
#
|
||||
# This is just meant as an example of why we wrote curl in the first place.
|
||||
# Quick n' easy scripting use.
|
||||
#
|
||||
|
||||
$dir = $ARGV[0];
|
||||
|
||||
$target = $ARGV[1];
|
||||
|
||||
$maxdepth = $ARGV[2];
|
||||
|
||||
if($dir eq "" || $target eq "") {
|
||||
print "Usage: <URL> <dir> [max depth level] \n";
|
||||
print " End the URL with a slash if a directory is specified, please\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
if(($maxdepth ne "") && ($maxdepth == 0)) {
|
||||
# reached maximum depth, die
|
||||
print "Reached maximum recursive depth level ($maxdepth), exiting...\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
# get dir
|
||||
@all = `curl -s $dir`;
|
||||
|
||||
if($all[0] ne "") {
|
||||
print "Got the main $dir dir\n";
|
||||
}
|
||||
|
||||
line:
|
||||
for(@all) {
|
||||
chop; # cut off newline
|
||||
@linep= split(" ", $_);
|
||||
|
||||
$name = $linep[$#linep];
|
||||
|
||||
$firstletter=substr($linep[0], 0, 1);
|
||||
|
||||
if($firstletter eq "d") {
|
||||
# this is a subdir, recurse
|
||||
# if not . or .. of course
|
||||
|
||||
if(($name eq ".") || ($name eq "..")) {
|
||||
next line;
|
||||
}
|
||||
print "Recursing for dir $dir$name in target $target/$name\n";
|
||||
|
||||
$nextdepth=$maxdepth-1;
|
||||
print `$0 $dir$name/ $target/$name $nextdepth`;
|
||||
}
|
||||
elsif($firstletter eq "-") {
|
||||
# this is a file, get it
|
||||
# oh, make sure the target dir exists first
|
||||
|
||||
if(! -r $target ) {
|
||||
mkdir($target,0777);
|
||||
}
|
||||
print "Getting file $dir$name in target $target/$name\n";
|
||||
print `curl -s $dir$name >$target/$name`;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue