Search code examples
javahashamazon-s3compareupdating

How to compare local file with Amazon s3 file


I'm working on a desktop Java application. It needs to check for a specific file on my S3 server.

I don't want to download the entire file to compare, I need to find out if the one in the server is newer then the local one and then download and replace.

I'm not sure how to do the check if newer available part of this.

I've heard of hashing as a method but I have little experience with how to actually do that on both fronts (locally and via S3)


Solution

  • To get the hash of the remote file: How to get the md5sum of a file on Amazon's S3

    To get the hash of the local file: Getting a File's MD5 Checksum in Java