Windows 资源管理器中文件夹“修改日期”的规则

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1025187/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 06:31:30  来源:igfitidea点击:

Rules for "Date Modified" of folders in Windows Explorer

windowsdatetimeexplorerdirectory

提问by Kevin Haines

How does Windows Explorer determine the "Date Modified" field for folders? [Aside: I know this is asking from an explorer-specific perspective, but the behaviour could be useful to coding search/sort type activities]

Windows 资源管理器如何确定文件夹的“修改日期”字段?[旁白:我知道这是从特定于资源管理器的角度提出的问题,但该行为可能对编码搜索/排序类型的活动有用]

Is there a definitive description of this anywhere - searches of Microsoft, MSDN, Google & Stack Overflow have been unsuccessful.

是否有任何地方对此的明确描述 - 对 Microsoft、MSDN、Google 和 Stack Overflow 的搜索均未成功。

Personal experiments seem to suggest that in a tree of folders:

个人实验似乎表明在文件夹树中:

  1. when a folder/file is added/deleted in a folder, the containing folder'sdate modified is updated.
  2. when the content of a file is modified, the containing folder is unaffected
  1. 在文件夹中添加/删除文件夹/文件时,将更新包含文件夹的修改日期。
  2. 当文件内容被修改时,包含的文件夹不受影响

However, I'm looking at some directories that don't seem to conform to these basic rules - running down the tree I have (dates in DD/MM/YYYY format):

但是,我正在查看一些似乎不符合这些基本规则的目录 - 沿着我拥有的树(DD/MM/YYYY 格式的日期)运行:

folder     (date created:  2/2/2006, date modified: 2/3/2006)
  folder   (date created:  2/2/2006, date modified: 2/3/2006)
    folder (date created:  2/2/2006, date modified: 1/6/2009)
      file (date created: 27/3/2009, date modified: 2/2/2006)

采纳答案by J-16 SDiZ

This is not explorer specific, this is NTFS-related.

这不是特定于资源管理器的,而是与 NTFS 相关的。

See http://support.microsoft.com/kb/299648https://web.archive.org/web/20080219020154/http://support.microsoft.com/kb/299648for some rules.

有关某些规则,请参阅http://support.microsoft.com/kb/299648https://web.archive.org/web/20080219020154/http://support.microsoft.com/kb/299648

Note: Modified time can be disabled with filesystem option, so you should never rely on it. Any suggested reliable methods would be appreciated.

注意:可以使用文件系统选项禁用修改时间,因此您永远不要依赖它。任何建议的可靠方法将不胜感激。

回答by Roman Starkov

Disclaimer: I tested all of these myself on Windows 10. I could not find an authoritative source documenting all of these behaviours. It is entirely possible that I made a mistake somewhere.

免责声明:我自己在 Windows 10 上测试了所有这些。我找不到记录所有这些行为的权威来源。我完全有可能在某个地方犯了错误。

The folder's last modified time is updatedfor these actions:

文件夹的上次修改时间针对以下操作进行更新

  • new file or folder directly in target folder
  • renamed file or folder directly in target folder
  • deleted file or folder directly in target folder
  • hardlink create/delete/rename - same as files
  • file/folder symlink create/delete/rename
  • directory junction create/delete/rename
  • 直接在目标文件夹中新建文件或文件夹
  • 直接在目标文件夹中重命名文件或文件夹
  • 直接在目标文件夹中删除的文件或文件夹
  • 硬链接创建/删除/重命名 - 与文件相同
  • 文件/文件夹符号链接创建/删除/重命名
  • 目录连接创建/删除/重命名

It is not updatedfor these actions:

不会更新这些行动:

  • modified contents of file directly in target folder
  • edit target of symlink or junction contained in target folder
  • file's or sub-folder's created/modified date changing
  • edit basic attributes (hidden/archive/system) of a direct child
  • NTFS compression/encryption change of a direct child
  • anything at all happening in a sub-folder - literally anything
  • changing attributes of the folder itself
  • changing owner/ACL of the folder itself
  • owner or ACL of a direct child changing
  • if the folder is a directory junction, changing the target
  • adding/deleting alt data streams to a direct child file
  • 直接在目标文件夹中修改文件的内容
  • 编辑目标文件夹中包含的符号链接或连接的目标
  • 文件或子文件夹的创建/修改日期更改
  • 编辑直接子项的基本属性(隐藏/存档/系统)
  • 直接子项的 NTFS 压缩/加密更改
  • 子文件夹中发生的任何事情 - 几乎任何事情
  • 更改文件夹本身的属性
  • 更改文件夹本身的所有者/ACL
  • 直接子项的所有者或 ACL 更改
  • 如果文件夹是目录结点,则更改目标
  • 将 alt 数据流添加/删除到直接子文件