Windows filesystem: Creation time of a file doesn't change when while is deleted and created again

前端 未结 2 1727
别那么骄傲
别那么骄傲 2020-12-03 17:16

I have a following scenario:

  • 1: Create a bunch of files

  • 2: Call some external app that processes all files with different creation time sin

相关标签:
2条回答
  • 2020-12-03 17:55

    You could use SetFileTime to update the create time as soon as you create the file.

    0 讨论(0)
  • 2020-12-03 18:09

    I believe you are encountering a phenomenon in Windows known as filesystem tunneling. This is a feature of NT based systems wherein a new file with the same name as a recently deleted file in the same directory will inherit the creation time of the old file.

    You can disable tunneling or alter the length of time for which the old file data is cached. See this Microsoft KB article for details.

    Filesystem tunneling was implemented since many applications will delete and recreate files they wish to alter rather than merely update them.

    You should be able to use @Jim Rhodes suggestion to counteract this feature.

    0 讨论(0)
提交回复
热议问题