AWS 从 S3 获取最近 6 个月的图像
AWS get last 6 month images from S3
我有很多图像存储在 AWS s3 中。
无论如何我只想下载最近 6 个月的图像。使用 shell 脚本或 aws cli。
aws s3api list-objects --bucket "mybucket" --prefix "some/prefix" --query "Contents[?LastModified>=`2018-08-22`].{Key: Key}"
我现在可以使用此命令列出 6 个月内的所有对象我该如何下载。
提前致谢..!
您可以通过管道输出以这种方式下载匹配的文件
aws s3api list-objects --bucket mybucket --output text --prefix some/prefix --query "Contents[?LastModified>='2018-08-22'].{Key: Key}" | xargs -I {} echo aws s3 cp s3://mybucket/{} .
当您使用 | 进行管道传输时,您正在使用一个命令的输出到 运行 下一个命令。
我有很多图像存储在 AWS s3 中。
无论如何我只想下载最近 6 个月的图像。使用 shell 脚本或 aws cli。
aws s3api list-objects --bucket "mybucket" --prefix "some/prefix" --query "Contents[?LastModified>=`2018-08-22`].{Key: Key}"
我现在可以使用此命令列出 6 个月内的所有对象我该如何下载。
提前致谢..!
您可以通过管道输出以这种方式下载匹配的文件
aws s3api list-objects --bucket mybucket --output text --prefix some/prefix --query "Contents[?LastModified>='2018-08-22'].{Key: Key}" | xargs -I {} echo aws s3 cp s3://mybucket/{} .
当您使用 | 进行管道传输时,您正在使用一个命令的输出到 运行 下一个命令。