在Mac OS X中通过curl保存文件时,有没有办法给出特定的文件名? [英] Is there a way to give a specific file name when saving a file via curl in Mac OS X?

查看:425
本文介绍了在Mac OS X中通过curl保存文件时,有没有办法给出特定的文件名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用curl在Mac OS X终端中拉取文件,并想给他们不同的名字。



感谢

-o 选项,或者通过使用>将shell输出重定向到所选择的文件;

  curl -o / path / to / local / file http:// url。 com 
curl http://url.com> / path / to / local / file

如果要保留来自远程服务器的原始文件名,请使用 -O 选项。

  curl -O http://url.com/file.html 

将当前目录中远程位置的输出存储为file.html。


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?

Thanks

解决方案

Either use the -o option, 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

If you want to preserve the original file name from the remote server, use the -O option.

curl -O http://url.com/file.html 

Stores the output from the remote location in the current directory as file.html.

这篇关于在Mac OS X中通过curl保存文件时,有没有办法给出特定的文件名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆