最新消息:时间抓起来说是金子,抓不住就是流水。

批量下载 抓取内容

Shell 镜花水月 6414浏览 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服务器运维架构技术分享 » 批量下载 抓取内容

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址