如何使用bash下载大约1000个小文件(〜20kb)
在URL中,有一定数量的小JPEG文件(约20KB),例如:
https://example.com/file=1.0
https://example.com/file=1.1
...
https://example.com/file=1.973
https://example.com/file=1.974
如何使用bash脚本下载它们?我不知道如何编写脚本,但是我认为使用WGET有一些简单的方法。
它们具有相同的 filename.jpeg
,因此需要使用连续名称下载它们,例如 filename-1.jpg
, filename-2.jpg
。 。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
curl具有此内置功能,能够下载带有生成序列的多个URL,并将这些相同的序列应用于保存的文件名:
请参阅: https://curl.se/docs/manpage.html#-o
Curl has this built-in feature to be able to download multiple URLs with generated sequences and apply those same sequences to the saved file name:
See: https://curl.se/docs/manpage.html#-o
编辑:以下的改进版本将是(感谢评论):(
在此特定情况下可能不需要引用,因为只有数字值,但可以遵守最佳实践。)
您可以使用
对于
带有seq
之类的>:Edit: An improved version of the below would be (thanks to the comments):
(The quotes might not be required in this particular case as there are only numeric values, but it's good to adhere to best practices.)
You can use
for
withseq
like this: