![]() |
![]() |
![]() |
Has a file changed? I want to detect if a file has changed. I don't want to be notified, I just want to go back and look at it and see if the content has changed. I do not want to have to read the content. I'm happy that it could be circumventable. What I'm looking for is a 99% sure way of seeing if a file has changed.
gwyn
On Unix you'd use the 'stat' call and check for modified date or file size as your indicator. Don't know what Win would use.
5v3n
Clear the archive flag.
René Nyffenegger
Trouble with relying on the archive bit is that some other program might set or unset it, like a backup program. I'd rely on a combination of file size and last modified.
Matthew Lock
If you have the .NET runtime installed, they have a class called FileSystemWatcher that can respond to change events within the file system
CF
If you have .NET you can easily use an MD5 checksum to check if the file has changed. This is what I do in my version control system. Works like a champ. Of course this requires writing a few lines of code. Just thought I'd throw this at you.
Anon
Use the file date. It will work 99% of the time.
njkayaker
create a hash for each file in each folder and periodically rerun the hash to see if there is any diff.
Sound like date/time + size will work ok for me.
gwyn
No need for .NET programming for computing hashes
Just me (Sir to you)
No need to use .NET to watch file systems either.
Jan Derk
Are you male or female Jan?
Anon
look into md5sum.
acm
The guy asked to not have to read the contents of the file. Anytime you do a checksum/hash, you're reading the contents of the file, no?
Ankur
Yes, the OP did specify that requirement. However, given that md5sum can do its "thing" extremely quickly, it may be useful to either the OP or others reading this topic. Just depends on where you are placed on the accuracy vs speed trade-off
Chris
|