本文翻译自: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
最后不会。