How to rename the downloaded file with wget?

前端 未结 3 1144
南笙
南笙 2021-01-30 09:58

To download the SOFA Statistics from the server I use the wget command:

wget -c http://sourceforge.net/projects/sofastatistics/files/latest/download?source=dlp
<         


        
3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-30 10:28

    If you were to do the same download from a web browser, and you notice the browser actually naming the file correctly, you can use the --content-disposition option to give wget the same behaviour:

    wget --content-disposition http://sourceforge.net/projects/sofastatistics/files/latest/download?source=dlp
    

    My Debian man page reports this as an 'experimental' feature but I cant recall it not working for me:

           --content-disposition
               If this is set to on, experimental (not fully-functional) support for "Content-Disposition" headers is enabled. This can currently result in extra round-trips to the server
               for a "HEAD" request, and is known to suffer from a few bugs, which is why it is not currently enabled by default.
    
               This option is useful for some file-downloading CGI programs that use "Content-Disposition" headers to describe what the name of a downloaded file should be.
    

提交回复
热议问题