shutil.copy2(src, dst, *, follow_symlinks=True)
Identical to copy()
except that copy2()
also attempts to preserve all file metadata.
When follow_symlinks is false, and src is a symbolic link, copy2()
attempts to copy all metadata from the src symbolic link to the newly-created dst symbolic link. However, this functionality is not available on all platforms. On platforms where some or all of this functionality is unavailable, copy2()
will preserve all the metadata it can; copy2()
never returns failure.
copy2()
uses copystat()
to copy the file metadata. Please see copystat()
for more information about platform support for modifying symbolic link metadata.
Changed in version 3.3: Added follow_symlinks argument, try to copy extended file system attributes too (currently Linux only). Now returns path to the newly created file.
Please login to continue.