wget将下载的文件保存为短链接名称,而不是实际文件名

我正在尝试下载主链接上的所有文件,它们都是下载的,但是按照单独的短链接命名

wget –content-disposition -i http://ligman.me/2sZVmcG

其中一个结果:

--2017-08-03 12:12:16--  http://ligman.me/1IW1oab
Connecting to ligman.me (ligman.me)|67.199.248.12|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://download.microsoft.com/DOWNLOAD/D/6/7/D670D322-5771-409E-BF34-5B98496DEB0A/MICROSOFT_PRESS_EBOOK_INTRODUCING_AZURE_PDF.PDF [following]
--2017-08-03 12:12:16--  http://download.microsoft.com/DOWNLOAD/D/6/7/D670D322-5771-409E-BF34-5B98496DEB0A/MICROSOFT_PRESS_EBOOK_INTRODUCING_AZURE_PDF.PDF
Resolving download.microsoft.com (download.microsoft.com)... 23.211.1.18, 2a02:26f0:ce:29c::e59, 2a02:26f0:ce:298::e59
Connecting to download.microsoft.com (download.microsoft.com)|23.211.1.18|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8395026 (8.0M) [application/octet-stream]
Saving to: ‘1IW1oab.2’

1IW1oab.2                                    100%[===============================================================================================>]   8.01M  5.17MB/s   in 1.5s

2017-08-03 12:12:18 (5.17 MB/s) - ‘1IW1oab.2’ saved [8395026/8395026]

如何让wget将文件保存为原始名称,这可以很明显地被“看到”?

最佳答案
选项–trust-server-names应该这样做.

–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.

转载注明原文:wget将下载的文件保存为短链接名称,而不是实际文件名 - 代码日志