Skip to content
Advertisement

How to download multiple links into a folder via wget in linux

When I want to download a file in a folder in Linux via wget I use the following:

wget -P /patch/to/folder/ http://example.com/file.zip

Now let’s say I want to download several files into the same folder and my urls are:

http://example.com/file1.zip
http://example.com/file2.zip
http://example.com/file3.zip

How can I achieve this in one with command in the same folder /patch/to/folder/?

Thank you.

Advertisement

Answer

You can just append more URLs to your command:

wget -P /patch/to/folder/ http://example.com/file1.zip http://example.com/file2.zip http://example.com/file3.zip

If they only differ by number, you can have bash brace expansion automatically generate all the arguments before wget runs:

wget -P /patch/to/folder/ http://example.com/file{1..3}.zip 

You can tell that this is possible from the invocation synopsis in man wget, where the ... is a convention that means it can accept multiple at a time:

SYNOPSIS
   wget [option]... [URL]...
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement