On 10/15/20, Rob Cliffe via Python-Dev <python-dev@python.org> wrote: > > TLDR: In os.scandir directory entries, atime is always a copy of mtime > rather than the actual access time.
There are inconsistencies in various scenarios between between the stat info from the directory entry and the stat info from the File Control Block (FCB) -- the filesystem's in-memory record that's common to all opens for a file/directory. The worst case is for an NTFS file with multiple hardlinks, for which the directory entry information is from the last time the file was opened using a particular hardlink. The accurate NTFS file information is in the file's Master File Table (MFT) record, which gets accessed to populate the FCB and update the particular link when a file is opened. If you're looking for file times and file size, the only reliable information comes from directly opening the file an querying the info via GetFileInformationByHandle (called by os.stat), GetFileInformationByHandleEx (FileBasicInfo, FileStandardInfo), GetFileTime, and GetFileSizeEx. _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/IJIFZHPEEMVPD2LN6H3MY4KGRKNQ4TBQ/ Code of Conduct: http://python.org/psf/codeofconduct/