[英]How to sync directory with AWS S3 using Java SDK?
I came across this article https://aws.amazon.com/blogs/developer/syncing-data-with-amazon-s3/ which made me aware of the uploadDirectory() method.我看到这篇文章https://aws.amazon.com/blogs/developer/syncing-data-with-amazon-s3/这让我知道了 uploadDirectory() 方法。 The blog states: "This small bit of code compares the contents of the local directory to the contents in the Amazon S3 bucket and only transfer files that have changed."
该博客指出:“这一小段代码将本地目录的内容与 Amazon S3 存储桶中的内容进行比较,并且仅传输已更改的文件。” This does not seem to be entirely correct since it appears to always transfer every file in a given directory as opposed to only the files that have changed.
这似乎并不完全正确,因为它似乎总是传输给定目录中的每个文件,而不是仅传输已更改的文件。
I was able to do what I wanted using AWSCLI's s3 sync command, however the goal is to be able to do this syncing using the Java SDK.我能够使用 AWSCLI 的 s3 同步命令执行我想要的操作,但是目标是能够使用 Java SDK 执行此同步。 Is it possible to do this same type of sync using the Java SDK?
是否可以使用 Java SDK 进行相同类型的同步?
检查此解决方案: https : //github.com/nezarjhons/AmazonS3WithJava希望对您有所帮助
TransferManager.copy()
可能会做类似的事情,但我不知道在目标服务器上存在具有相同名称和修改时间的文件或目录的情况下会采用什么行为。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.