PyDocs

Nav

File and Directory Access

copy2

shutil

function (source)
  • copy2(src, dst, *, follow_symlinks=True)
Copy data and metadata. Return the file's destination.

Metadata is copied with copystat(). Please see the copystat function
for more information.

The destination may be a directory.

If follow_symlinks is false, symlinks won't be followed. This
resembles GNU's "cp -P src dst".
Changed in 3.3, 3.8
  • 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.
  • 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.
0 Examples
No examples for shutil/copy2.
See Also
No see-alsos for shutil/copy2
0 Notes
No notes for copy2