Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

i have a text file that contains a list of urls for files of my word

for example :

http://domain.com/file1.zip
http://domain.com/file2.zip
http://domain.com/file3.zip
http://domain.com/file4.zip

...etc

how can i batch download all files to a folder automatically from linux shell command

thanks for help

share|improve this question

4 Answers 4

up vote 8 down vote accepted

From man wget:

You have a file that contains the URLs you want to download? Use the -i switch:

wget -i <file>

share|improve this answer

You could also use xargs:

$ cat /path/to/list | xargs -n1 wget 

or, using seq to download file1.zip to file10.zip:

$ seq 1 10 | xargs -n1 -i wget http://domain.com/file{}.zip

[edit] or, as another poster pointed out: $ wget domain.com/file{1..10}.zip

which is nicer than the seq method, given that certain OSes don't have seq by default (Mac OS X, Solaris)

share|improve this answer
for i in `cat /file/list`

do

    wget $i

done

(those are back ticks in the "cat /file/list" (on the same key as the tilda)

share|improve this answer

This command downloads file1.zip to file10.zip:

for i in $(seq 1 10);  do wget -nv http://domain.com/file${i}.zip ; done
share|improve this answer
    
if they were sequential, you could just do wget domain.com/file{1..10}.zip curl also has good support for file ranged, but I always forget the syntax. –  Justin Jan 2 '10 at 19:23

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.