wget命令下载文件并另存为不同的文件名

本文翻译自:wget command to download a file and save as a different filename

I am downloading a file using the wget command. 我正在使用wget命令下载文件。 But when it downloads to my local machine, I want it to be saved as a different filename. 但是当它下载到我的本地机器时,我希望它保存为不同的文件名。

For example: I am downloading a file from www.examplesite.com/textfile.txt 例如:我正在从www.examplesite.com/textfile.txt下载文件

I want to use wget to save the file textfile.txt on my local directory as newfile.txt . 我想使用wget将文件textfile.txt保存在我的本地目录中newfile.txt I am using the wget command as follows: 我使用wget命令如下:

wget www.examplesite.com/textfile.txt

#1楼

参考:https://stackoom.com/question/17ypr/wget命令下载文件并另存为不同的文件名


#2楼

Use the -O file option. 使用-O file选项。

Eg 例如

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]

#3楼

You would use the command Mechanical snail listed. 您将使用列出的Mechanical蜗牛命令。 Notice the uppercase O. Full command line to use could be: 注意要使用的大写O. Full命令行可以是:

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

or 要么

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

Hope that helps. 希望有所帮助。


#4楼

Also notice the order of parameters on the command line. 还要注意命令行上的参数顺序。 At least on some systems (eg CentOS 6): 至少在某些系统上(例如CentOS 6):

wget -O FILE URL

works. 作品。 But: 但:

wget URL -O FILE

does not work. 不起作用。


#5楼

Using CentOS Linux I found that the easiest syntax would be: 使用CentOS Linux我发现最简单的语法是:

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. 其中"link"是您要保存的网址, "file.ext"是您选择的文件名和扩展名。


#6楼

wget -O yourfilename.zip remote-storage.url/theirfilename.zip

will do the trick for you. 会为你做的伎俩。

Note: 注意:

a) its a capital O. a)它的资本O.

b) wget -O filename url will only work. b) wget -O filename url只能工作。 Putting -O last will not. -O最后不会。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值