Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider implementing partial checksum #3

Open
imagejan opened this issue Mar 12, 2021 · 0 comments
Open

Consider implementing partial checksum #3

imagejan opened this issue Mar 12, 2021 · 0 comments

Comments

@imagejan
Copy link
Member

Before deleting source files, we compare files by their os.stat() signature (filecmp.cmpfiles() with default shallow=True) here:

# and compare them (shallow).
(matches, _, _) = filecmp.cmpfiles(current_dir, dest_dir,
potential_matches)

This should be enough to also catch mismatches in creation dates (such as the 1980-01-01 ones created by Robocopy on incomplete files), but needs to be tested. We might want to offer an additional layer of safety.

Since comparing the full file contents (shallow=False) might decrease the performance too much, let's consider offering an option to compare partial checksum (e.g. on the first 128 kb) for each file, as suggested by @enricotagliavini.

/cc @lgelman

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant