2

I'm trying to download all the books from a URL list in bulk. The list is in a text file in http://ligman.me/W3TuLr. I'm trying to use wget on linux for this. All these URLs seem to be created using a URL shortening service. The problem is when I run wget --server-response --input-file=list.txt, the files are downloaded ok, but wget uses the shortened URL tag as their name, while I can see in server responses that the Location header for the direct file URL contains the real readable book name in it.

How can I get wget to write the output file in the readable file name? wget version is 1.13.4.

I'm open to any other linux comnands which can perform the same task.

  • HAve you tried using curl instead? – arielnmz Jul 13 '14 at 5:39
  • curl acts the same and it does not even support urls list in a file. I had to use xargs. – zaadeh Jul 14 '14 at 10:02
8

Use the --trust-server-names option:

--trust-server-names: If this is set to on, on a redirect the last component of the redirection URL will be used as the local file name. By default it is used the last component in the original URL.

Note that in some cases this can be a security risk: you have no way of knowing what the created filename will be until you get it, and conceivably it could overwrite something you want. This used to be the default behaviour until that issue was discovered.

0

Have your tried the following

     $ wget -i downloadaddreslist.txt

where downloadaddresslist.txt is the file of the addresses?

  • 1
    isn't -i option the same as --input-file which I have used? – zaadeh Jul 13 '14 at 5:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.