[英]<AWS S3> How to download S3 bucket files based on modified date?
I have a use case where I need to download bucket files within a particular modified date range only for diagnosis purpose.我有一个用例,我需要下载特定修改日期范围内的存储桶文件,仅用于诊断目的。 There is a large amount of files in the bucket so it is not pracitcal to download all files for the purpose.存储桶中有大量文件,因此为此目的下载所有文件并不实用。 I have looked at the AWS CLI and it seems there is no readily available S3 options for this (there is only a "--include" option which filters by file name only).我查看了 AWS CLI,似乎没有现成的 S3 选项(只有一个“--include”选项,仅按文件名过滤)。 May I seek for your advice on this?我可以就此征求您的意见吗? Thank you谢谢
DATE=$(date +%Y-%m-%d)
FILE="$(aws s3api list-objects --bucket bucket_name --query 'Contents[?LastModified>= `'"$DATE"'`][].{Key: Key}' --output=text| grep file_name)"
aws s3 cp s3://bucket_name/${FILE} .
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.