两个文件夹中有哪些文件相同_Windows如何确定带有相同时间戳的两个文件中的哪个较新?...

两个文件夹中有哪些文件相同_Windows如何确定带有相同时间戳的两个文件中的哪个较新?...

两个文件夹中有哪些文件相同

两个文件夹中有哪些文件相同_Windows如何确定带有相同时间戳的两个文件中的哪个较新?...

What does it mean when you have two identical files with identical time stamps, yet Windows says that one file is newer than the other one? How can that be? Today’s SuperUser Q&A post helps a confused reader solve a time stamp mystery.

当您有两个带有相同时间戳的相同文件,但是Windows表示一个文件比另一个文件新时,这意味着什么? 怎么可能? 今天的“超级用户”问答文章可帮助困惑的读者解决时间戳的奥秘。

Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.

今天的“问答”环节由SuperUser提供,它是Stack Exchange的一个分支,该社区是由社区驱动的Q&A网站分组。

问题 (The Question)

SuperUser reader WBT wants to know how Windows decides which of two files with identical time stamps is newer:

超级用户阅读器WBT想知道Windows如何确定带有相同时间戳的两个文件中的哪个更新:

When Windows displays a dialog like this with matching time stamps, how does it determine which of the two files is newer?

Windows显示带有匹配时间戳的对话框时,如何确定两个文件中的哪个较新?

两个文件夹中有哪些文件相同_Windows如何确定带有相同时间戳的两个文件中的哪个较新?...

At first, I thought Windows was comparing the date created attribute and using the result of that comparison to label one or the other as newer. If a file was copied into a particular location, it may have the creation date of when the copy was made rather than the creation date of the original file. However, after reproducing it with another file, the result of which one is newer seems to be the opposite:

起初,我认为Windows正在比较创建日期属性,并使用比较结果将一个或另一个标记为较新。 如果将文件复制到特定位置,则文件的创建日期可能是复制时的日期,而不是原始文件的创建日期。 但是,在用另一个文件再现它之后,结果却是相反的:

两个文件夹中有哪些文件相同_Windows如何确定带有相同时间戳的两个文件中的哪个较新?...

The result is the same whether copying or moving the file:

无论复制还是移动文件,结果都是相同的:

两个文件夹中有哪些文件相同_Windows如何确定带有相同时间戳的两个文件中的哪个较新?...

And for background, the file in test2 is a previously made copy of the file in test1.

对于背景,test2中的文件是test1中文件的先前制作的副本。

How does Windows decide which of two files with identical time stamps is newer?

Windows如何确定带有相同时间戳的两个文件中的哪个较新?

答案 (The Answer)

SuperUser contributor grawity has the answer for us:

超级用户贡献者的感谢为我们提供了答案:

Time stamps in the NTFS file system have a resolution of 100 nanoseconds (0.0000001 s). Even if the properties dialog shows the same rounded value, it could still be that the files were created within tenths of a second of each other.

NTFS文件系统中的时间戳具有100纳秒(0.0000001 s)的分辨率。 即使属性对话框显示相同的舍入值,也可能是在彼此之间十分之一秒之内创建了文件。

Note: Most file systems measure times in μs or ns. FAT32 is a bit of a relic and rounds timestamps to two seconds.

注意:大多数文件系统的时间以μs或ns为单位。 FAT32有点遗迹,并且将时间戳舍入为两秒。

Try one of the following methods to compare the full time stamps:

尝试使用以下方法之一来比较完整时间戳:

  • wmic datafile where name=”c:\\foo\\bar.txt” get lastmodified

    WMIC数据文件,其中名称=“ c:\\ foo \\ bar.txt”得到最后修改

Via PowerShell:

通过PowerShell:

  • (Get-ChildItem c:\foo\bar.txt).LastWriteTime.ToString(“o”)

    (Get-ChildItem c:\ foo \ bar.txt).LastWriteTime.ToString(“ o”)


Have something to add to the explanation? Sound off in the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.

有什么补充说明吗? 在评论中听起来不错。 是否想从其他精通Stack Exchange的用户那里获得更多答案? 在此处查看完整的讨论线程

Image Credit: WBT (SuperUser)

图片来源: WBT(超级用户)

翻译自: https://www.howtogeek.com/293768/how-does-windows-decide-which-of-two-files-with-identical-time-stamps-is-newer/

两个文件夹中有哪些文件相同