gtxyzz

批量下载 抓取内容

gtxyzz linux 2023-01-25 481浏览 0
#!/bin/bash

. urldat
domain="http://www.baidu.com"
for i in $filename

{
        if [[ -e $i ]];then
                echo "$i file is exist">>log.log
        else
        {
                name=${i##*/}
                path=${i%%/$name}
                if [[  -d $path ]];then
                        echo "wget  $domain/$i to $path/$name" >>wget.log
                        wget -c $domain/$i -o $path/$name -nv
                        if (( $? != 0 ));then 
                                echo "down $i is fail" >>log.log
                        fi
                else
                      echo  "mkdir -p $path"
                        echo "wget $i to $path/$name"
                        wget -c $domain/$i -o $path/$name -nv
                        if (( $? != 0 ));then 
                                echo "down $i is fail" >>log.log
                        fi
                fi
        }
        fi
}

继续浏览有关 LINUX技术 的文章
发表评论