amazon-web-services - AWS S3 CLI 中的选择性文件下载

标签 amazon-web-services amazon-s3

我在 S3 存储桶中有文件,我试图根据 8 月 8 日、8 月 9 日等日期下载文件,如何下载选择性日期文件?
我使用了以下代码,但它仍会下载整个存储桶列表

aws s3 cp s3://bucketname/ folder/file --profile pname --exclude \"*\" --recursive --include \"" + "2015-08-09" + "*\"

我不确定,如何实现这一目标。

最佳答案

此命令将复制所有以 2015-08-15 开头的文件:

aws s3 cp s3://BUCKET/ folder --exclude "*" --include "2015-08-15*" --recursive

如果您的目标是同步一组文件而不将它们复制两次,请使用 sync命令:
aws s3 sync s3://BUCKET/ folder

这将复制自上次同步以来添加或修改的所有文件。

其实这相当于上面的cp命令:
aws s3 sync s3://BUCKET/ folder --exclude "*" --include "2015-08-15*"

引用:
  • AWS CLI s3 sync command documentation
  • AWS CLI s3 cp command documentation
  • 关于amazon-web-services - AWS S3 CLI 中的选择性文件下载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31942341/

    相关文章:

    c# - TestWebACL 错误原因 : Your statement has multiple values set for a field that requires exactly one value

    amazon-web-services - 将 AWS S3 API 与 React Native 结合使用

    javascript - Amazon S3 签名有效但被禁止

    amazon-s3 - AWS Glue 爬网程序 - 分区键类型

    php - 资源空间DAM系统-将外部存储设置为AWS S3

    image - 操作系统 : How to easily view thumbnails of lots of images in an S3 bucket

    amazon-web-services - 根据 Policy : Policy Condition failed: ["eq", "$acl", "public-read"无效] 来自 postman

    amazon-s3 - 如何使用 sc.textFile ("s3n://bucket/*.csv") 将文件名映射到 RDD?

    angularjs - 适用于 Safari 的 AWS (Cloudfront/S3) 上的 Angular

    amazon-web-services - 地形。标记使用 Autoscaling 组创建的实例