July 9th, 2010

What's the difference between LastWriteTime and ChangeTime in FILE_BASIC_INFO?

The FILE_BASIC_INFO structure contains a number of fields which record the last time a particular action occurred. Two of the fields seem to describe the same thing.

Last­Write­Time
The time the file was last written to.

Change­Time

The time the file was changed.

What’s the difference between writing to a file and changing it? I’m told that the difference is metadata. The Last­Write­Time covers writes to the file’s data stream (which you accomplish via the Write­File function). On the other hand, the Change­Time also includes changes to the file metadata, such as changing its file attributes (hidden, read-only, etc.) or renaming the file.

(And don’t forget that Last­Access­Time updates are off by default now.)

Topics
Code

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.

Feedback