I want to make a procedure that does one way syncrhonization of a folder between a server and a client. I was thinking to use ModifiedDate as a criterio, provided that only the date of the server files will be used. Procedure will not use Modified dates of files on the client at all. It will read dates from the server and compare them with dates read from the server last time the procedure run.
Do you think this is safe?
Is there any possibility that Modified Date will not be changed when a file is edited or it will be changed without touching the contents of the file (eg. from some strange antivirus programs)?
I want to make a procedure that does one way syncrhonization of a folder
Share
Don’t count on the modification date of a file.
Strange programs (antiviruses and such) are not the problem more than the fact that you simply can’t count on the client and server clocks to be synchronized.Why not do a straightforward diff or hash calculation? You can’t get a better comparison than that.
Taking performance considerations into effect, you can use the following heuristic:
touched). In this case in order to get a definitive answer you must examine the file somehow.Bottom line: modification date can always give you a true negative (file not changed), but might sometimes yield a false positive – and this case you must verify.