Y
Y
Yuri Petrashevich2014-10-10 17:37:57
linux
Yuri Petrashevich, 2014-10-10 17:37:57

linux. Wget. How to set the name of the saved file when reading from the list?

There is a file, in it links which need to be downloaded line by line are entered. Tell me how you can set the name of the file to be saved. For example, create another file with the same number of lines as in the first one, and so that the names for the saved file would be taken from there. Or some other way.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
3
3vi1_0n3, 2014-10-10
@BelCoder

Something like this:

#!/bin/bash

(while read url filename
do
  wget $url -O $filename
done) < wget-list.txt

wget-list.txt looks like this:
урл1 имя_файла1
урл2 имя_файла2
....
урлN имя_файлаN

M
Maxim Kovalenko, 2014-11-04
@maxxx_kovalenko

I found a way to download files with correct names in Cyrillic from the exchanger ex.ua
wget -i file list.urls -c --content-disposition --trust-server-names=on --restrict-file-names=nocontrol

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question