如何使用curl或wget将文件下载到目录中? [英] How to download a file into a directory using curl or wget?

查看:201
本文介绍了如何使用curl或wget将文件下载到目录中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可以使用以下2个命令来下载一个文件:

  curl -O example.com/file。 zip 
wget example.com/file.zip

但我想让他们进入特定目录。所以我可以这样做:

  curl -o mydir / file.zip example.com/file.zip 
wget -O mydir / file.zip example.com/file.zip

有没有办法必须指定文件名?像这样:

  curl -dir mydir example.com/file.zip 


解决方案

以下行会将所有文件下载到您提及的目录。

  wget -P / home / test www.xyz.com 

这里的文件将下载到 / home / test 目录


I know I can use the following 2 commands to download a file:

curl -O example.com/file.zip
wget example.com/file.zip

But I want them to go into a specific directory. So I can do the following:

curl -o mydir/file.zip example.com/file.zip
wget -O mydir/file.zip example.com/file.zip

Is there a way to not have to specify the filename? Something like this:

curl -dir mydir example.com/file.zip

解决方案

The following line will download all the files to a directory mentioned by you.

wget -P /home/test www.xyz.com

Here the files will be downloaded to /home/test directory

这篇关于如何使用curl或wget将文件下载到目录中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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