wget command to download a file and save as a different filename

前端 未结 5 1263
南方客
南方客 2020-11-30 16:29

I am downloading a file using the wget command. But when it downloads to my local machine, I want it to be saved as a different filename.

For example: I

相关标签:
5条回答
  • 2020-11-30 16:47

    Use the -O file option.

    E.g.

    wget google.com
    ...
    16:07:52 (538.47 MB/s) - `index.html' saved [10728]
    

    vs.

    wget -O foo.html google.com
    ...
    16:08:00 (1.57 MB/s) - `foo.html' saved [10728]
    
    0 讨论(0)
  • 2020-11-30 16:49

    You would use the command Mechanical snail listed. Notice the uppercase O. Full command line to use could be:

    wget www.examplesite.com/textfile.txt --output-document=newfile.txt
    

    or

    wget www.examplesite.com/textfile.txt -O newfile.txt
    

    Hope that helps.

    0 讨论(0)
  • 2020-11-30 17:01

    Also notice the order of parameters on the command line. At least on some systems (e.g. CentOS 6):

    wget -O FILE URL
    

    works. But:

    wget URL -O FILE
    

    does not work.

    0 讨论(0)
  • 2020-11-30 17:05

    Using CentOS Linux I found that the easiest syntax would be:

    wget "link" -O file.ext
    

    where "link" is the web address you want to save and "file.ext" is the filename and extension of your choice.

    0 讨论(0)
  • 2020-11-30 17:07
    wget -O yourfilename.zip remote-storage.url/theirfilename.zip
    

    will do the trick for you.

    Note:

    a) its a capital O.

    b) wget -O filename url will only work. Putting -O last will not.

    0 讨论(0)
提交回复
热议问题