FTP Validation

Ray Turner
Ray Turner used Ask the Experts™
Using Microsoft .NET Framework Version 4.8.03752 I performed a [successful] FTP upload.  How do I compare the source and the target to verify they match?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
IT Support Specialist
Hi ,

A good way to do this is to generate hashes of all the files in the source directory and the destination directory and compare the two folders.

Here's a quick and easy way to compare the contents of two folders with PowerShell.

Dr. KlahnPrincipal Software Engineer

Normally FTP is only used between two systems that do not have any other means of connectivity, so the options are:

a) Ship a copy of the received file back to the source system and compare it there.  100% reliable except for the vanishingly unlikely possibility that an error occurred in the original transmission, and the exact same error occurred (but inverted) in the re-transmission back to the sender.  Uses up twice the bandwidth, though.

b) Per Saad's comment above, after the transmission send at least two different hashes of the transmitted file to the receiving system, regenerate the hashes there, and see if they match.  Not 100% reliable but very, very reliable and the additional bandwidth is negligible.

Possibly a better solution for infrequent use:  Encapsulate the file using an error-detecting and error-correcting encapsulator such as RAR, which will not only detect errors but correct them during the un-encapsulation.  Significant overhead but all the detection and correction can be done on the receiving end.
David FavorFractional CTO
Distinguished Expert 2018

Aside: Remember, FTP is hackable + SFTP is secure.

Only use FTP if being hacked is acceptable.
Ray TurnerSenior Consultant



Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial