在 wget 或 curl 查询中使用通配符 [英] Using wildcards in wget or curl query

查看:33
本文介绍了在 wget 或 curl 查询中使用通配符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从目录下载时是否可以在 wget 查询中使用通配符?基本上,我有一个站点,例如 www.download.example.com/dir/version/package.rpm.然而,版本目录一直在变化,有时会包含多个 RPM 包.是否有一个 wget 查询可以只获取我和 version 目录中的所有包而不知道那个版本是什么?在我的理想世界中,查询将类似于:

Is it possible to use wildcards in wget queries when downloading from directories? Basically, I have a site, say, www.download.example.com/dir/version/package.rpm. Howevery, the version directory changes all the time and sometimes contains multiple RPM packages. Is there a single wget query that would get me only and all the packages in the version directory without knowing what that version is? In my ideal world, the query would be something like:

wget www.download.example.com/dir/*/*.rpm

如果有办法用 curl 做到这一点,那也行.

If there is a way to do this with curl, that would work as well.

推荐答案

您不能在 wget 中使用通配符,但 -A 标志应该可以使用.来自 wget 手册页:

You can't use wildcards in wget but the -A flag should work. From the wget manpage:

您想从 http 服务器上的目录下载所有 gif.您尝试了 wget http://www.server.com/dir/*.gif,但没有奏效,因为 http 检索不支持 globbing.在这种情况下,请使用:wget -r -l1 --no-parent -A.gif http://www.server.com/dir/

You want to download all the gifs from a directory on an http server. You tried wget http://www.server.com/dir/*.gif, but that didn't work because http retrieval does not support globbing. In that case, use: wget -r -l1 --no-parent -A.gif http://www.server.com/dir/

发现了一个相关问题

关于目录:

有一个名为 LFTP 的实用程序,它对通配符有一定的支持.查看手册页.还有另一个 Linux 上的问题 &Unix 涵盖其在与您类似的场景中的用法.

There's a utility called LFTP, which has some support for globbing. Take a look at the manpage. There's another question on Linux & Unix that covers its usage in a scenario similar to yours.

这篇关于在 wget 或 curl 查询中使用通配符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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