开发者

Using command line to save large amount of HTML files

开发者 https://www.devze.com 2023-02-10 05:56 出处:网络
I Have website I need to save a large amount开发者_运维问答 of pages from.The pages are in incremental order, index.php?id=1, index.php?id=2....Is there a shell script(using mac) I could run to loop t

I Have website I need to save a large amount开发者_运维问答 of pages from. The pages are in incremental order, index.php?id=1, index.php?id=2.... Is there a shell script(using mac) I could run to loop through all of these pages and save them individually into a directory?


In bash:

for i in {1..100}; do wget http://www.example.com/index.php?id=${i}; done


#!/bin/bash
url='http://example.com/index.php?='
dir='path/to/dir'
filename=file
extension=ext

for i in {1..100}
do
    wget "$url$i" -O "$dir$filename$i.$ext"
done
0

精彩评论

暂无评论...
验证码 换一张
取 消