[Python] Modifying timestamps on Windows reparse points

Discussão em 'Python' iniciado por Stack, Agosto 3, 2025.

  1. Stack

    Stack Membro Participativo

    I need to copy timestamps (modified time) between NTFS reparse points of type junction, directory symlink and file symlink.

    I can get the timestamp of a reparse point with os.lstat(). But to apply that timestamp I would need to use os.utime() but its parameter follow_symlinks is not implemented on Windows, so os.utime() always sets the timestamp on the target of a reparse point but I need to set it on the reparse point itself.

    >>> os.utime in os.supports_follow_symlinks
    False


    So how can I set time on Windows reparse points in Python?

    I prefer solutions using ctypes over third party libraries for this.

    Continue reading...

Compartilhe esta Página