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?
Answer
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
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.
…
No comments:
Post a Comment