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

时间:2023-01-17 09:12:54

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.

是否有任何明确的描述 - 微软,MSDN,谷歌和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's date modified is updated.
  2. 在文件夹中添加/删除文件夹/文件时,将更新包含文件夹的修改日期。

  3. when the content of a file is modified, the containing folder is unaffected
  4. 修改文件内容时,包含文件夹不受影响

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)

2 个解决方案

#1


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

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

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

有关一些规则,请参阅http://support.microsoft.com/kb/299648 https://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.

注意:可以使用filesystem选项禁用修改时间,因此您不应该依赖它。任何建议的可靠方法将不胜感激。

#2


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 updated for 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
  • hardlink create / delete / rename - 与文件相同

  • file/folder symlink create/delete/rename
  • 文件/文件夹符号链接创建/删除/重命名

  • directory junction create/delete/rename
  • 目录连接创建/删除/重命名

It is not updated for 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
  • NTFS压缩/加密直接子项的更改

  • anything at all happening in a sub-folder - literally anything
  • 任何事情都发生在子文件夹中 - 几乎任何东西

  • changing attributes of the folder itself
  • 更改文件夹本身的属性

  • changing owner/ACL of the folder itself
  • 更改文件夹本身的所有者/ ACL

  • owner or ACL of a direct child changing
  • 直接孩子改变的所有者或ACL

  • if the folder is a directory junction, changing the target
  • 如果文件夹是目录连接,则更改目标

  • adding/deleting alt data streams to a direct child file
  • 将alt数据流添加/删除到直接子文件

#1


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

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

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

有关一些规则,请参阅http://support.microsoft.com/kb/299648 https://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.

注意:可以使用filesystem选项禁用修改时间,因此您不应该依赖它。任何建议的可靠方法将不胜感激。

#2


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 updated for 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
  • hardlink create / delete / rename - 与文件相同

  • file/folder symlink create/delete/rename
  • 文件/文件夹符号链接创建/删除/重命名

  • directory junction create/delete/rename
  • 目录连接创建/删除/重命名

It is not updated for 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
  • NTFS压缩/加密直接子项的更改

  • anything at all happening in a sub-folder - literally anything
  • 任何事情都发生在子文件夹中 - 几乎任何东西

  • changing attributes of the folder itself
  • 更改文件夹本身的属性

  • changing owner/ACL of the folder itself
  • 更改文件夹本身的所有者/ ACL

  • owner or ACL of a direct child changing
  • 直接孩子改变的所有者或ACL

  • if the folder is a directory junction, changing the target
  • 如果文件夹是目录连接,则更改目标

  • adding/deleting alt data streams to a direct child file
  • 将alt数据流添加/删除到直接子文件