I'm not sure if I will be writing this in PHP, Perl or a Shell script but I would like to do some research first. What is the best way to determine if a file has been changed? Would it be to compare the file size of a "good" version to the current version? Is there a better way?
What is HASH, wouldn't this help me in some way? Or the CRC value?
Please post your ideas!
Determine if File has Changed
Started by oppo, Oct 22 2007 06:19 AM
5 replies to this topic
#1
Posted 22 October 2007 - 06:19 AM
|
|
|
#2
Posted 22 October 2007 - 08:18 AM
A Hash is a type of index that gives you a radically different value with a small change in the object hashed. As a result, it can be an effective method for checking if a file has changed. MD5 and CRC are two commonly used hashes.
#3
Posted 23 October 2007 - 12:07 PM
Can you not store the date it was last modified?
Too simple?
Too simple?
#4
Posted 23 October 2007 - 01:18 PM
G_Morgan said:
Can you not store the date it was last modified?
Too simple?
Too simple?
This would work but wouldn't a hash value be better??
How do you even generate a hash value on a file using any language?
#5
Posted 23 October 2007 - 02:00 PM
oppo said:
This would work but wouldn't a hash value be better??
How do you even generate a hash value on a file using any language?
How do you even generate a hash value on a file using any language?
Depends. A hash value would work even if someone touched the file to update it's time stamp without modifying it's contents.
What system are you using. Unix will usually have the md5sum program installed. Call that and store the output, then call it again and compare. Note that for large files it might take a while, the time stamp will certainly be the quickest.
#6
Posted 31 October 2007 - 12:36 AM
I would reccomend the MD5 value. Do yuo wnt to see the changes or only if the file has changed or not?


Sign In
Create Account


Back to top









