Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bash: Download files from file list

Tags:

bash

I have a file named files.txt with all files which I want download.

files.txt

http://file/to/download/IC_0000.tpl
http://file/to/download/IC_0001.tpl

If I use

cat files.txt | egrep -v "(^#.*|^$)" | xargs -n 1 wget

all files are downloaded.

But I dont know how to use If files.txt contains only files without http

files.txt

IC_0000.tpl
IC_0001.tpl

I have "wget" only with this paramter:

Usage: wget [-c|--continue] [-s|--spider] [-q|--quiet] [-O|--output-document FILE]
        [--header 'header: value'] [-Y|--proxy on/off] [-P DIR]
        [--no-check-certificate] [-U|--user-agent AGENT] [-T SEC] URL...

Can you help me, please.

Many thanks.

like image 923
skyndas Avatar asked Sep 05 '25 02:09

skyndas


1 Answers

Simply try wget -i files.txt (see http://www.gnu.org/software/wget/manual/wget.html#Logging-and-Input-File-Options)

If you don't have the host in the file, try:

for i in `cat files.txt`; do wget "${HOST}/${i}"; done
like image 160
Max Noel Avatar answered Sep 07 '25 18:09

Max Noel