从目录中获取图像

发布于 2024-10-09 15:48:45 字数 80 浏览 0 评论 0原文

嘿。 我有一个公共目录,其中包含许多 JPG 图像。如何使用 WGET 将每张图片下载到本地计算机上的特定目录中?谢谢

Hey.
I have a public directory that contains a number of JPG images. How can I use WGET in order to download each picture into a specific directory on my local machine? thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不乱于心 2024-10-16 15:48:45

wget -r --directory-prefix=/path/to/save/to -A jpg www.example.com/path/to/image/directory

全部来自 wget 手册

-A 参数允许您指定文件名后缀你关心的(还有一个类似的-R来排除文件):

-r是递归检索,所以它会进入子目录。

--directory-prefix=/path 指定保存位置。

对于 -A 标志,我将从手册中截取一段代码:

-A acclist --accept acclist

-R rejlist --reject rejlist

指定要接受或拒绝的文件名后缀或模式的逗号分隔列表(请参阅文件类型)。请注意,如果任何通配符“*”、“?”、“[”或“]”出现在 acclist 或 rejlist 的元素中,它将被视为模式,而不是后缀。

wget -r --directory-prefix=/path/to/save/to -A jpg www.example.com/path/to/image/directory

All from the wget manual

The -A argument allows you to specify the file name suffixes that you care about (there's also a similar -R to exclude files):

-r is recursive retrieval, so it will go into subdirectories.

--directory-prefix=/path specifies where to save to.

And the -A flag, I'll cut a snippet from the manual:

-A acclist --accept acclist

-R rejlist --reject rejlist

Specify comma-separated lists of file name suffixes or patterns to accept or reject (see Types of Files). Note that if any of the wildcard characters, ‘*’, ‘?’, ‘[’ or ‘]’, appear in an element of acclist or rejlist, it will be treated as a pattern, rather than a suffix.

奶气 2024-10-16 15:48:45

首先,确保您的服务器上有目录列表(恕我直言,这不是一个好的设置)。
接下来,让 wget 获取此列表,以某种方式解析它,最后 wget 每个图像。

First of, ensure you have directory listing on your server (not a good setting imho).
Next, make wget get this listing, parse it somehow and finally wget each image.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文