Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I tell if a file on an FTP is identical to a local file with out actually downloading the file?

I'm writing a simple program that is used to synchronize files to an FTP. I want to be able to check if the local version of a file is different from the remote version, so I can tell if the file(s) need to be transfered. I could check the file size, but that's not 100% reliable because obviously it's possible for two files to be the same size but contain different data. The date/time the files were modified is also not reliable as the user's computer date could be set wrong.

Is there some other way to tell if a local file and a file on an FTP are identical?

like image 833
Eric Anastas Avatar asked Oct 08 '09 22:10

Eric Anastas


People also ask

Does FTP use checksum?

First, your remote FTP server must support the checksum calculation. Not all FTP servers support this; even the RFC specification does not define a command to calculate a checksum of a remote file. Many modern FTP servers support determining checksums (CRC-32, MD5 or SHA-1) of remote files.

How do I view files on an FTP server?

Open a Windows explorer window (Windows key + E) and type the FTP address (ftp://domainname.com) in the file path at the top and hit Enter. Enter the username and password into the prompt window. You can save the password and the login settings to expedite future logins.

Which is the best reason to use the file transfer protocol FTP application?

FTP is user-friendly. Ideal for daily business operations requiring file transfers between multiple stakeholders. FTP is ideal for backup of large amounts of business data. Web developers use FTP to move their code to the server hosting the website they're working on.


1 Answers

There isn't a generic way. If the ftp site includes a checksum file, you can download that (which will be a lot quicker since a checksum is quite small) and then see if the checksums match. But of course, this relies on the owner of the ftp site creating a checksum file and keeping it up to date.

Other then that, you are S.O.L.

like image 65
R Samuel Klatchko Avatar answered Sep 20 '22 23:09

R Samuel Klatchko