LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Multiple File Download (https://www.linuxquestions.org/questions/linux-software-2/multiple-file-download-760401/)

atheist 10-07-2009 04:49 PM

Multiple File Download
 
I need a really simple program (or a script?) that downloads multiple files with one command.

I want to be able to enter a file name, and then download five different URLs with that file name in them. For example:

Entering "1234" would download the following files:
http://www.asdf.com/1234
http://www.sdfg.com/1234
http://www.hfdf.com/1234
http://www.hfdd.com/1234
http://www.ryte.com/1234
http://www.dtyf.com/1234
http://www.hjtt.com/1234

Does this make sense? I'm sure there's a more efficient way than to type in the wget command manually for all different URLs?

Thanks.

David the H. 10-07-2009 05:40 PM

A simple loop is all you should need. I believe this will work, but it's untested.

Code:

#!/bin/bash

filename="1234"
filelist="url1 url2 url3 url4 url5"

for i in $filelist; do

wget "${i}/${filename}"

done

Of course there are also a variety of download managers out there also. Probably some of them have the ability to do similar things. Try an apt-cache search or two.

atheist 10-17-2009 06:21 PM

Awesome. Thank you.


All times are GMT -5. The time now is 12:15 AM.