AWS S3 CLI 中的选择性文件下载 [英] Selective file download in AWS S3 CLI

查看:41
本文介绍了AWS S3 CLI 中的选择性文件下载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have files in S3 bucket, I was trying to download files based on date like 08th aug, 09th Aug, how can I download selective date file?. I used following code but it still downloads entire bucket list

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

我不确定,如何实现这一点.

I am not sure, how to achieve this.

推荐答案

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

This command will copy all files starting with 2015-08-15:

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

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

If your goal is to synchronize a set of files without copying them twice, use the sync command:

aws s3 sync s3://BUCKET/ folder

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

That will copy all files that have been added or modified since the previous sync.

其实这相当于上面的cp命令:

In fact, this is the equivalent of the above cp command:

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

参考文献:

这篇关于AWS S3 CLI 中的选择性文件下载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆