How do I save a file using the response header filename with cURL?

后端 未结 4 1914
不思量自难忘°
不思量自难忘° 2020-12-08 01:59

This question relates to the command line version of cURL.

I\'m trying to download a file from a CGI script.

http://example.com/perl/dl.pl?ID=2
         


        
4条回答
  •  感动是毒
    2020-12-08 02:14

    if you have a new enough curl (version 7.20.0 or later), -J/--remote-header-name is what you want.

    You use -J in conjunction with -O, which makes curl use the file name part from the URL as its primary way to name the output file and then if there is a Content-disposition: header in the response, curl will use that name instead.

提交回复
热议问题