Downloading multiple files, and specifying output filenames with wget

I'm using wget with the -i option to download a list of files from a URL.

However, I want to specify the names that these files will be saved with as well.

I see you can do that with a single file using -O, and can specify a directory with -P; is it possible to download a list of files, and specify filenames for each of them?


wget

Probably not with wget

perl

Something like ...

perl -MLWP::Simple -lane 'getstore($F[0],$F[1])' urls_and_filenames.txt

For Windows use " instead of '

curl

I note that curl has some options that might be relevant

-K, --config

Specify which config file to read curl arguments from.

--url

Specify a URL to fetch. This option is mostly handy when you want to specify URL(s) in a config file.

This option may be used any number of times. To control where this URL is written, use the -o, --output or the -O, --remote-name options.

-o, --output <file>

Write output to instead of stdout. If you are using {} or [] to fetch multiple documents, you can use '#' followed by a number in the specifier. That variable will be replaced with the current string for the URL being fetched. Like in:

curl http://{one,two}.site.com -o "file_#1.txt"

or use several variables like:

curl http://{site,host}.host[1-5].com -o "#1_#2"

You may use this option as many times as the number of URLs you have.


Not wget, but aria2c supports this https://aria2.github.io/manual/en/html/aria2c.html#input-file

aria2c -i fileList.txt

For example, the content of fileList.txt is:

http://server/file.iso http://mirror/file.iso
  dir=/iso_images
  out=file.img
http://foo/bar

If aria2 is executed with -i fileList.txt -d /tmp options, then file.iso is saved as /iso_images/file.img and it is downloaded from http://server/file.iso and http://mirror/file.iso. The file bar is downloaded from http://foo/bar and saved as /tmp/bar.