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

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

问题描述

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

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

如果有办法用 curl

解决方案

wget中不能使用通配符,但 -A 标志应该工作。从 wget联机帮助页


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


编辑:找到相关问题



关于目录: b

有一个名为 LFTP 的实用程序,它有一些支持globbing。请查看联机帮助页。在Linux和其他平台上还有另一个问题。 Unix ,其涵盖了与您的情况类似的情况。


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

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

解决方案

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

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/

Edit: found a related question

Regarding directories:

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天全站免登陆