In brief
shutil.copy2() attempts to preserve more file metadata than merely copying contents. The documentation warns that even high-level copying cannot transfer every attribute on every platform.
Useful to know
shutil.copy2() attempts to preserve more file metadata than merely copying contents. The documentation warns that even high-level copying cannot transfer every attribute on every platform. [1]
For backups or migration, establish whether ownership, permissions or special streams matter. Checking file size alone does not prove complete equivalence. Contents and their access context are different parts of the task.
Sources
For further detail and to check the information: