How can I determine if an FTP file is identical to the local file with the actual file upload?

I am writing a simple program that is used to synchronize files with FTP. I want to check if the local version of the file is different from the remote version, so I can check if the file (s) need to be transferred. I can check the file size, but it is not 100% more reliable, because, obviously, two files can be the same size but contain different data. The date and time the files were changed are also unreliable, since the date of the user's computer may not be set correctly.

Is there any other way to find out if the local file and the file on FTP are identical?

+5
source share
6 answers

There is no general way. If the ftp site has a checksum file, you can upload it (which will be much faster since the checksum is quite small), and then see if the checksums match. But, of course, it depends on the owner of the ftp site creating the checksum file and keeping it up to date.

Other then you are SOL

+5
source

If the server is a simple FTP protocol, you can do nothing better than checking the size and time stamps.

FTP / , - " ", , HTTP, .

, FTP , . , rsync - .

+2

. md5 ( sha1, sha2 ..) , , .

+1

IETF , FTP-, MD5 MMD5.

http://www.faqs.org/rfcs/ftp-rfcs.html

FTP . FTP-, , , MD5/MMD5. , , .

+1

, FTP-, ( , , , xml , , /). , , -, , . , , , FileSystemWatcher.

0

All Articles