I have a program that relies on file timestamps that works fine in XP but fails in Windows 7.

I ran the following test in Windows 7:

Create go.bat to look at all 3 file timestamps:

@echo off
dir /tc test* | find "test"
dir /tw test* | find "test"
dir /ta test* | find "test"

notepad test.txt and create the file
run go.bat

10/10/2011  09:42 AM                 6 test.txt
10/10/2011  09:42 AM                 6 test.txt
10/10/2011  09:42 AM                 6 test.txt

wait till 9:43, notepad test.txt, don’t change anything, just close the file

10/10/2011  09:42 AM                 6 test.txt
10/10/2011  09:42 AM                 6 test.txt
10/10/2011  09:42 AM                 6 test.txt

Why didn’t the access time change?
Wait till 9:44, notepad test.txt, add a couple characters and save the changes

10/10/2011  09:42 AM                 8 test.txt
10/10/2011  09:44 AM                 8 test.txt
10/10/2011  09:42 AM                 8 test.txt

The write time changed because I modified the file, but how did I modify the file without accessing it? The access time did not change. Why?

It is disabled by default. Enable it with fsutil behavior set disablelastaccess 0 at the command prompt (as administrator of course)

Thanks nezachem,

That explains it, but I want to work within defaults, so I'll try to modify the program logic to use strictly write time.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.