【问题标题】:Downloading pattern matched entries from S3 bucket从 S3 存储桶下载模式匹配条目
【发布时间】:2014-09-25 00:58:10
【问题描述】:

我有一个 S3 存储桶,其中存储了几个具有以下格式的日志文件 index.log.yyyy-mm-dd-01 index.log.yyyy-mm-dd-02 . . .

yyyy 表示年份,mm 表示月份,dd 表示日期。

现在我只想下载其中的几个。我看到了Downloading an entire S3 bucket?。如果我想下载整个存储桶,这篇文章的公认答案绝对可以正常工作,但是如果我想做一些模式匹配,我应该怎么做?我尝试了以下命令,但没有奏效:

aws s3 sync s3://mybucket/index.log.2014-08-01-* .
aws s3 sync 's3://mybucket/index.log.2014-08-01-*' .

我还尝试使用 s3cmd 进行下载,使用 http://fosshelp.blogspot.in/2013/06 文章的 POINT 7 和 http://s3tools.org/s3cmd-sync。以下是我运行的命令:

s3cmd -c myconf.txt get --exclude '*.log.*' --include '*.2014-08-01-*' s3://mybucket/ .
s3cmd -c myconf.txt get --exclude '*.log.*' --include '*.2014-08-01-*' s3://mybucket/ .

还有一些其他的排列方式。

谁能告诉我为什么没有发生模式匹配?或者如果我需要使用任何其他工具。

谢谢!!

【问题讨论】:

    标签: amazon-web-services amazon-s3 command-line-interface s3cmd


    【解决方案1】:

    找到问题的解决方案。虽然我不知道为什么其他命令不起作用..解决方案如下:

    aws s3 sync s3://mybucket . --exclude "*" --include "*.2014-08-01-*"
    

    注意:--exclude "*" 应该在 --include "---" 之前,反向操作不会打印任何内容,因为它将在 'include' 之后执行 'exclude'(现在无法找到引用我读过这个)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-05-05
      • 1970-01-01
      • 2021-08-14
      • 2012-01-29
      • 2017-02-16
      • 2013-10-15
      相关资源
      最近更新 更多