Sync
sync.mirror()
Replicate src onto dst (a local path or "host:path") and verify it by sha256.
Usage
sync.mirror(
src,
dst,
*,
delete_source=False,
)Runs rsync -a, sweeps AppleDouble ._* files after every hop, then diffs a sorted sha256 manifest of both trees; a mismatch triggers up to MAX_REPAIR_ROUNDS checksum re-syncs before raising SyncVerificationError. Source contents are removed only when delete_source is set and the tree verifies clean.
Parameters
src: Path-
The local directory to replicate.
dst: str-
The destination, either a local path or an
rsync/ssh"host:path"spec. delete_source: bool = False- Remove the source contents once, and only once, the mirror verifies.
Returns
A: SyncReport- class:SyncReport describing the verified transfer.
Raises
SyncVerificationError- A required tool is missing, or the tree stays unverified.
sync.SyncReport
The outcome of a verified mirror(): file/byte counts and swept AppleDoubles.
Usage
sync.SyncReport(files, bytes, verified, swept_appledoubles)Parameter Attributes
files: intbytes: intverified: boolswept_appledoubles: int
sync.SyncVerificationError
A mirror could not be verified clean; carries the unverified file list in mismatches.
Usage
sync.SyncVerificationError(message, *, mismatches=())