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.

2
  • HAve you tried using curl instead?
    – arielnmz
    Jul 13, 2014 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, 2014 at 10:02

2 Answers 2

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
0

Have your tried the following

     $ wget -i downloadaddreslist.txt

where downloadaddresslist.txt is the file of the addresses?

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .