Primary
shutil.copy() ⚬|Documentation|1st|20251021204916-00-⌔
shutil — High-level file operations — Python 3 documentation#shutil.copy
shutil.copy(src, dst, ﹡, follow_symlinks=True)Copies the file src to the file or directory dst. src and dst should be path-like objects or strings. If dst specifies a directory, the file will be copied into dst using the base filename from src. If dst specifies a file that already exists, it will be replaced. Returns the path to the newly created file.
If follow_symlinks is false, and src is a symbolic link, dst will be created as a symbolic link. If follow_symlinks is true and src is a symbolic link, dst will be a copy of the file src refers to.
copy()copies the file data and the file’s permission mode (seeos.chmod()). Other metadata, like the file’s creation and modification times, is not preserved. To preserve all file metadata from the original, usecopy2()instead.Raises an auditing event
shutil.copyfilewith argumentssrc,dst.Raises an auditing event
shutil.copymodewith argumentssrc,dst.Changed in version 3.3: Added follow_symlinks argument. Now returns path to the newly created file.
Changed in version 3.8: Platform-specific fast-copy syscalls may be used internally in order to copy the file more efficiently. See Platform-dependent efficient copy operations section.
Printed 2026-06-28.
(echo:: @ ᯤ)
Link to original
Secondary
• • •