为什么Windows设置新创建的文件的“创建时间”财产到旧时代? [英] Why Windows sets new created file's "created time" property to old time?

查看:198
本文介绍了为什么Windows设置新创建的文件的“创建时间”财产到旧时代?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试这个我发现了一个奇怪的问题:
$ b $ ol
  • 删除一个旧文件。

  • 创建一个新文件并将其命名为旧文件。然后将新文件的创建时间属性设置为旧文件的创建时间。为什么会发生?怎么样?


    解决方案

    这是由于的文件系统隧道,由雷蒙德·切解释说:



    为什么隧道存在所有?

    在使用程序编辑现有文件并保存时,您希望保留原始创建时间戳,因为您正在编辑文件,而不是创建一个新的,但是在内部,许多程序通过执行保存,删除和重命名操作(如链接文章中列出的操作)的组合来保存文件,并且在没有隧道的情况下,文件的创建时间会作为隧道重要性的另一个例子,考虑这个文件长名称的文件 .txt,它的简称是FILEWI〜1.TXT。你把这个文件加载到一个不能识别长文件名的程序中保存它,删除旧的FILEWI〜1.TXT,并创建一个同名的新文件。没有隧道,文件的关联长名称将会丢失。这个文件名不是一个友好的长名字,而是被腐蚀的标记损坏了。不好。


    Trying this I have found a strange problem:

    1. Delete an old file.
    2. Create a new file and name it the same as the old file.

    Then the "created time" property of the new file is set to the "created time" of the old file. Why does that happen? And how?

    解决方案

    It's due to file system tunnelling, as explained by Raymond Chen:

    "Why does tunneling exist at all?

    When you use a program to edit an existing file, then save it, you expect the original creation timestamp to be preserved, since you're editing a file, not creating a new one. But internally, many programs save a file by performing a combination of save, delete, and rename operations (such as the ones listed in the linked article), and without tunneling, the creation time of the file would seem to change even though from the end user's point of view, no file got created.

    As another example of the importance of tunneling, consider that file "File with long name.txt", whose short name is say "FILEWI~1.TXT". You load this file into a program that is not long-filename-aware and save it. It deletes the old "FILEWI~1.TXT" and creates a new one with the same name. Without tunnelling, the associated long name of the file would be lost. Instead of a friendly long name, the file name got corrupted into this thing with squiggly marks. Not good."

    这篇关于为什么Windows设置新创建的文件的“创建时间”财产到旧时代?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆