Multiple simultaneous downloads using Wget?

前端 未结 16 1203
旧时难觅i
旧时难觅i 2020-12-04 04:50

I\'m using wget to download website content, but wget downloads the files one by one.

How can I make wget download using 4 simultaneous connections?

16条回答
  •  时光取名叫无心
    2020-12-04 05:21

    I found (probably) a solution

    In the process of downloading a few thousand log files from one server to the next I suddenly had the need to do some serious multithreaded downloading in BSD, preferably with Wget as that was the simplest way I could think of handling this. A little looking around led me to this little nugget:

    wget -r -np -N [url] &
    wget -r -np -N [url] &
    wget -r -np -N [url] &
    wget -r -np -N [url]
    

    Just repeat the wget -r -np -N [url] for as many threads as you need... Now given this isn’t pretty and there are surely better ways to do this but if you want something quick and dirty it should do the trick...

    Note: the option -N makes wget download only "newer" files, which means it won't overwrite or re-download files unless their timestamp changes on the server.

提交回复
热议问题