Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
    
Potential duplicate: superuser.com/questions/61025/… –  leecbaker Sep 17 '11 at 9:18

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer

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.