微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

windows-server-2008 – “右键单击文件”会更新其上次访问时间吗?

我正在使用GetFileTime检查文件的上次访问时间,它可以工作.但它甚至给我时间我最后一次点击它的时间,这是预期的吗?但它不会显示文件属性的“常规”选项卡中的“已访问:”字段中.
简答:是的,右键单击文件更新的文件信息并触发记录的更新,并可由GetFileTime检索.

然而,真正的答案有点复杂.

NTFS技术上只需在目录中列出文件即可更新LastAccess Time.因此,只需打开文件所在的目录,就会触发该目录中所有文件的更新.

Windows 7开始,有一个注册表项禁用此项以防止NTFS日志填满.认值阻止NTFS在列出NTFS卷中的目录时更新每个文件和目录的最后访问时间戳:https://technet.microsoft.com/en-us/library/cc959914.aspx

这些系统中的不同文件系统和不同指标也具有不同的时间分辨率:

Not all file systems can record creation and last access times,and not all file systems record them in the same manner. For example,the resolution of create time on FAT is 10 milliseconds,while write time has a resolution of 2 seconds and access time has a resolution of 1 day,so it is really the access date. The NTFS file system delays updates to the last access time for a file by up to 1 hour after the last access.

有关详细信息,请参见此处:http://msdn.microsoft.com/en-us/library/ms724290(v=vs.85).aspx

For a file,the structure specifies when the file is last read from or written to. For a directory,the structure specifies when the directory is created. For both files and directories,the specified date is correct,but the time of day is always set to midnight. If the underlying file system does not support last access time,this member is zero.

从这里:http://msdn.microsoft.com/en-us/library/aa365739(v=vs.85).aspx

这些在这里找到:https://superuser.com/questions/232143/windows-7-file-properties-is-date-accessed-always-100-accurate

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐