![]() |
File modified date problem
I'm trying to write some code to determine if two copies of a file
stored on two different drives are identical. I thought this would be fairly easy by checking the file length and the modified date. In doing this I found that if I copy a file to a different location on the same drive, the modified date stays the same. But if I copy the file to a different drive the modified date is changed by a second or two. I've tried this numerous times with different variations and always get the same results - copy a file to the same drive, same modified date; copy it to a different drive and you now you have different modified dates. I see the same results whether I check it using FileDateTime or DateLastModified. In Windows Explorer you don't notice this because it doesn't show the seconds. So now my questions... Does this happen to everyone else too? Why would Microsoft do this? (I know - a stupid question.) How can I determine if files on different drives are the same when the modified date changes even when the file hasn't been modified? I can't rely on file length alone because it is possible to change a file and have its length remain the same. I can't do a comparison of the file contents because there are many files to check and it would probably take forever. Any suggestions would be greatly appreciated. Tony |
File modified date problem
Wouldn't something like this faux code do the job ...
If Abs(FileOne.ModifiedDate - FileTwo.ModifiedDate) < 3 Seconds and _ FileOne.Length = FileTwo.Length Then Files are the Same End If -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware "Just Me" wrote in message I'm trying to write some code to determine if two copies of a file stored on two different drives are identical. I thought this would be fairly easy by checking the file length and the modified date. In doing this I found that if I copy a file to a different location on the same drive, the modified date stays the same. But if I copy the file to a different drive the modified date is changed by a second or two. I've tried this numerous times with different variations and always get the same results - copy a file to the same drive, same modified date; copy it to a different drive and you now you have different modified dates. I see the same results whether I check it using FileDateTime or DateLastModified. In Windows Explorer you don't notice this because it doesn't show the seconds. So now my questions... Does this happen to everyone else too? Why would Microsoft do this? (I know - a stupid question.) How can I determine if files on different drives are the same when the modified date changes even when the file hasn't been modified? I can't rely on file length alone because it is possible to change a file and have its length remain the same. I can't do a comparison of the file contents because there are many files to check and it would probably take forever. Any suggestions would be greatly appreciated. Tony |
File modified date problem
I'll probably end up doing something like that and possibly using the
archive attribute. But I'd still like to know why the date modified is slightly changed when a file is copied to a different drive - if anyone knows. Jim Cone wrote: Wouldn't something like this faux code do the job ... If Abs(FileOne.ModifiedDate - FileTwo.ModifiedDate) < 3 Seconds and _ FileOne.Length = FileTwo.Length Then Files are the Same End If -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware "Just Me" wrote in message I'm trying to write some code to determine if two copies of a file stored on two different drives are identical. I thought this would be fairly easy by checking the file length and the modified date. In doing this I found that if I copy a file to a different location on the same drive, the modified date stays the same. But if I copy the file to a different drive the modified date is changed by a second or two. I've tried this numerous times with different variations and always get the same results - copy a file to the same drive, same modified date; copy it to a different drive and you now you have different modified dates. I see the same results whether I check it using FileDateTime or DateLastModified. In Windows Explorer you don't notice this because it doesn't show the seconds. So now my questions... Does this happen to everyone else too? Why would Microsoft do this? (I know - a stupid question.) How can I determine if files on different drives are the same when the modified date changes even when the file hasn't been modified? I can't rely on file length alone because it is possible to change a file and have its length remain the same. I can't do a comparison of the file contents because there are many files to check and it would probably take forever. Any suggestions would be greatly appreciated. Tony |
All times are GMT +1. The time now is 10:39 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com