s3cmd sync 将两个桶移动到一个桶中

s3cmd sync move two buckets into a single bucket

我尝试使用 sync 命令执行此操作,但它试图从目标存储桶中删除不在源存储桶中的文件。如何使用 s3cmd 将两个桶移到一个桶中?

情况是我设置它的想法是我们将使用多个存储桶,但客户希望改为对所有文件使用一个存储桶。

当我尝试用 --skip-existing 标记它时 6559 files at destination to delete 这让我感到恐慌所以我只是 CTRL-C 脚本。我再次重新同步了第一个存储桶以确保它说要删除 13 个目标文件,但是当我转到存储桶时它们仍然存在。可以安全地假设 skip existing 会阻止它从远程存储桶中删除源存储桶中不存在的文件吗?

感谢来自 github 的@fviard 回答我的问题。复制到这里是我收到的答案:

By default, the sync don't delete files at destination that are not in the source. It can tell you that in the summary, but it will not do it. Check that you have the following configuration: delete_after = False delete_after_fetch = False delete_removed = False and that you don't use a option on the command line like "--delete-removed".

Btw, you are not needed to do things in separated commands. Without the "skip-existing", you can do something like that: sync s3://source1/ s3://source2/ s3://source3/ s3://mydestination/

TLDR;如果您在配置中将其配置为这样做,它只会删除文件。否则可以忽略警告消息。