简体   繁体   English

<aws s3>如何根据修改日期下载 S3 存储桶文件?</aws>

[英]<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.

相关问题 如何将多个文件直接下载、解压缩和传输到 s3 存储桶中? - How to download, decompress and transfer multiple files directly into an s3 bucket? AWS OpsWorks-Linux驱动器到S3存储桶 - AWS OpsWorks - Linux drive to S3 Bucket 如何在运行时使用python传递存储桶和本地文件夹值时,将所有文件从s3存储桶下载到本地linux服务器 - How to download all files from s3 bucket to local linux server while passing bucket and local folder value at runtime using python 从 s3 存储桶下载多个大于某个时间戳的文件 - download multiple files from s3 bucket greater than a certain timestamp 无论如何,是否使用ls和通配符从s3存储桶中提取文件? (aws cli) - Is there anyway to extract files from an s3 bucket using ls and wildcards? (aws cli) 从S3存储桶下载300万个对象的最快方法 - Fastest way to download 3 million objects from a S3 bucket 如何使用 AWS CLI 找到我的 AWS S3 存储桶的确切字节数? - How do I find the exact number of bytes of my AWS S3 bucket using AWS CLI? 如何仅显示来自 aws s3 ls 命令的文件? - How to display only files from aws s3 ls command? 从远程服务器复制到 s3 的文件不会在 s3 存储桶上显示状态 - files copying from remote server to s3 does not show status on s3 bucket 需要将jenkins日志文件推送到Amazon S3存储桶 - Need to push jenkins log files to Amazon S3 bucket
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM