通过cURL保存文件时,是否可以提供特定的文件名? [英] Is there a way to give a specific file name when saving a file via cURL?
本文介绍了通过cURL保存文件时,是否可以提供特定的文件名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在mac OS X终端中使用curl提取文件,并希望给它们指定不同的名称.使用curl时,是否可以指定名称,例如另存为"功能?
I am pulling files using curl in the mac OS X terminal and want to give them different names. Is there a way to specify a name, such as a "save as" function when using curl?
推荐答案
可以使用 -o
选项或别名--output
,或使用>
将shell输出重定向到所选文件.
Either use the -o
option or its alias --output
, or redirect shell output to the file of choice by using >
.
curl -o /path/to/local/file http://url.com
curl http://url.com > /path/to/local/file
如果要从远程服务器保留原始文件名,请使用 -O
选项或其别名--remote-name
.
If you want to preserve the original file name from the remote server, use the -O
option or its alias --remote-name
.
curl -O http://url.com/file.html
将来自远程位置的输出存储为当前目录中的file.html.
Stores the output from the remote location in the current directory as file.html.
这篇关于通过cURL保存文件时,是否可以提供特定的文件名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文