https://docs.python.org/3/library/shutil.html
The shutil
module offers a number of high-level operations on files and collections of files. In particular, functions are provided which support file copying and removal. For operations on individual files, see also the os
module.
shutil.``copyfileobj
(fsrc, fdst[, length])shutil.``copyfile
(src, dst, *, follow_symlinks=True)shutil.``copymode
(src, dst, *, follow_symlinks=True)
Copy the permission bits from src to dst. The file contents, owner, and group are unaffectedshutil.``copystat
(src, dst, *, follow_symlinks=True)
Copy the permission bits, last access time, last modification time, and flags from src to dst. 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.copy()
copies the file data and the file’s permission mode (see os.chmod()
). Other metadata, like the file’s creation and modification times, is not preserved.
To preserve all file metadata from the original, use copy2()
instead.
shutil.``copy2
(src, dst, *, follow_symlinks=True)
shutil.``copytree
(src, dst, symlinks=False, ignore=None, copy_function=copy2, ignore_dangling_symlinks=False, dirs_exist_ok=False)
Recursively copy an entire directory tree rooted at src to a directory named dst and return the destination directory.
If symlinks is true, symbolic links in the source tree are represented as symbolic links in the new tree and the metadata of the original links will be copied as far as the platform allows; if false or omitted, the contents and metadata of the linked files are copied to the new tree.
shutil.``rmtree
(path, ignore_errors=False, onerror=None)
Delete an entire directory tree; path must point to a directory (but not a symbolic link to a directory).
shutil.``move
(src, dst, copy_function=copy2)
Recursively move a file or directory (src) to another location (dst) and return the destination