How to download software recursively using curl
This article focuses on "how to use curl recursive download software", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to use curl to download recursive software.
The code is as follows:
#! / bin/env bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
Export PATH
Clear
Url= "http://mirrors.cnnic.cn/apache/"
DownListFile= "/ tmp/downlist.txt"
DownListTmpFile= "/ tmp/tmplist.txt"
DownFileType= "zip$ | gz$"
DownList= ""
UrlBack= "$Url"
[!-f $DownListFile] & & touch $DownListFile | | echo > $DownListFile
[!-f $DownListTmpFile] & & touch $DownListTmpFile | | echo > $DownListTmpFile
CURL_URLS () {
Urls= `curl $UrlBack | awk-F "a href=\"'{printf "% s\ n", $2}'| awk-F "\"'{printf "% s\ n", $1}'| grep-vE "^ $| ^\? | ^ http:\ /\ /" | ^ # `
}
URL_LIST () {
CURL_URLS
For i in $Urls; do
Echo "$UrlBack$i" > > $DownListTmpFile
Done
}
RECURSIVE_SEARCH_URL () {
UrlBackTmps= `cat $DownListTmpFile`
[["$UrlBackTmps" = ""]] & & echo "no more page for search" & & exit 1
For j in $UrlBackTmps; do
If [["${jackers *\ /}"! = "]]; then
Echo "$j" > > $DownListFile
Else
UrlBack= "$j"
URL_LIST
Fi
UrlTmps= `grep-vE "$j$" $DownListTmpFile`
Echo "$UrlTmps" > $DownListTmpFile
RECURSIVE_SEARCH_URL
Done
}
DOWNLOAD_FILE () {
DownList= `grep-E "$DownFileType" $DownListFile`
For k in $DownList; do
FilePath=/tmp/$ {kink * /\ /}
[!-d `dirname $FilePath`] & & mkdir-p `FilePath`
[!-f $FilePath] & & cd `dirname $FilePath` & & curl-O $k
Done
}
URL_LIST $Urls
RECURSIVE_SEARCH_URL
At this point, I believe you have a deeper understanding of "how to use curl recursive download software". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!