Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Compare Hash Values

807601Mar 8 2008 — edited Mar 9 2008
Not for an assignment or anything - I'm just interested!

I'm writing a simple backup program which will (hopefully) backup files automatically to external storage (just straight file copying - no gnarly encryption or anything).

Obviously I'm going to need to compare each file ("file") with it's backup version ("fileBKUP"). Rather than drag each fileBKUP from external storage and compare it with each file verbatim, I was thinking of:

1) creating a hash value for each fileBKUP as it's created and storing them in a file

2) at backup time copy these hash values into an array

3) cycle through files, creating hash value for each file and see if it's in the array of hashes

4) if it is, skip the file, if not back up the file and add the new hash value to the hash array and delete the old hash value (if the fileBKUP was indeed there at all)

5) after the last file, write the new hash values to the hash values file

Does this make any sense? Can hashes be used for this? Have I got this totally wrong? If this is going to fall flat on its face, what would you do to avoid dragging every file from the ext filestore?

Many thanks,

Anthony
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 6 2008
Added on Mar 8 2008
5 comments
723 views