AWS S3 sync-删除,在本地删除新文件 [英] AWS S3 sync --delete, removed new files in local

查看:799
本文介绍了AWS S3 sync-删除,在本地删除新文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

aws s3 sync --delete删除了一些新文件.

例如:

存储桶中有一个文件-S3://my-bucket/images/1.jpg

然后,我将文件上传到服务器:2.jpg

服务器中有2个文件:1.jpg2.jpg

开始运行同步cronjob:

aws s3 sync s3://my-bucket/ ./ --delete
aws s3 sync  ./ s3://my-bucket/ --delete


为什么要添加--delete-我们要删除s3中的文件并将其同步到服务器.

我们将文件上传到服务器并在s3中删除文件.

有什么办法可以解决?

解决方案

默认情况下,aws sync命令( 解决方案

By default, the aws sync command (see documentation) does not delete files. It simply copies new or modified files to the destination.

Using the --delete option deletes files that exist in the destination but not in the source.

So, if your source contains: 1.jpg and 2.jpg and the destination contains 1.jpg, 2.jpg and 3.jpg, then using the --delete option will delete 3.jpg from the destination.

I see that you are running the sync command in both directions. Your first command (that syncs S3 to a local directory) will delete any local files that are not in S3.

If your goal is to copy all local files to S3 and all S3 files to the local directory, without deleting any files, then do not use the --delete option.

这篇关于AWS S3 sync-删除,在本地删除新文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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