Answer the question
In order to leave comments, you need to log in
How to know that a file on the server has changed without downloading the file itself?
Hello. How can go tell if a file on the server has changed without downloading the file itself to the local machine. Because a file can weigh both 2 kb and 2 gb and uploading an unmodified file every time is not good.
1. Comparison of file sizes will not work. Because inside they can be different.
2. Comparison by creation time will not work either.
3. There is an option to download n bytes and compare the hash with the same amount from the local file.
Answer the question
In order to leave comments, you need to log in
The most reliable way is when uploading a file to a remote server, apply a hash sum to it (or calculate it on the server automatically after uploading). Then, to check the fact that the file has changed, it is enough to check the hash sums of the remote and local files.
3. There is an option to download n bytes and compare the hash with the same amount from the local file.
Bytes (in blocks) download from the server and read from the local disk.
Set a limit for byte-match validation.
And compare with each other:
1. Matched up to the limit - the files are the same, we interrupt the download.
2. No - download the updated file to the end.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question