Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How do you download a series of files with wget like so:

http://www.example.com/index.php?file=1
http://www.example.com/index.php?file=2
http://www.example.com/index.php?file=3
...
http://www.example.com/index.php?file=500
share|improve this question
3  
simultaneously or one by one? –  hakermania Jan 13 '13 at 13:51

2 Answers 2

up vote 4 down vote accepted

wget supports downloading more than a file with a single command. This means that you can take advantage of your shell features like so:

wget http://www.example.com/index.php?file={1..500}

If your URLs are in a file (one URL per line) or on standard input, you can also use wget's -i option.

share|improve this answer

Place all the urls in a file, one url per line. Let's call it file.txt.

Then place the code inside another file:

#!/bin/bash
while read url; do
   wget "$url"
done < file.txt

save the file at the same directory file.txt and execute it through a terminal.

If you would like to download the files simultaneously, then simply add an & after the wget "$url" command (at the same line)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.