[Python] Robocopy algorithm for /FFT and /DST options

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

  1. Stack

    Stack Membro Participativo

    Microsoft's Robocopy program has these two options:

    /FFT :: assume FAT File Times (2-second granularity).

    /DST :: compensate for one-hour DST time differences.


    What is the exact algorithm that Robocopy uses for this?

    If I wanted to implement this in Python for example, how would I do this? I would like to know specifically how Robocopy does it, and I would like to know if there is a more correct way to compare timestamps while allowing for DST and filesystem differences.

    def compare_file_timestamps_robocopy_style(file1, file2):
    """Returns True if the file timestamps should be considered equal when
    adjusted for filesystem granularity and daylight savings time.

    This uses the same algorithm as Microsoft's Robocopy.
    """
    time1 = os.path.getmtime(file1)
    time2 = os.path.getmtime(file2)
    return ???

    Continue reading...

Compartilhe esta Página