.NET FileInfo.LastWriteTime & FileInfo.LastAccessTime are wrong

前端 未结 7 1021
终归单人心
终归单人心 2020-12-01 13:54

When I call FileInfo(path).LastAccessTime or FileInfo(path).LastWriteTime on a file that is in the process of being written it returns the time tha

7条回答
  •  囚心锁ツ
    2020-12-01 14:52

    Starting in Windows Vista, last access time is not updated by default. This is to improve file system performance. You can find details here:

    http://blogs.technet.com/b/filecab/archive/2006/11/07/disabling-last-access-time-in-windows-vista-to-improve-ntfs-performance.aspx

    To reenable last access time on the computer, you can run the following command:

    fsutil behavior set disablelastaccess 0

提交回复
热议问题