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

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

问题描述

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

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/ / p>

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 ,它有一些支持globbing。请查看联机帮助页面。还有另一个 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天全站免登陆