[Solved] Python. Copy Files and Folders to existing directory [closed]


You can use the copytree function from the shutil package https://docs.python.org/3/library/shutil.html#shutil.copytree.

from shutil import copytree

src_path = "path/of/your/source/dir"
dest_path = "path/of/your/destination/dir"

copytree(src_path, dest_path, dirs_exist_ok=True)

The dirs_exist_ok=True parameter is useful if the dest_path already exists, and you want to overwrite the existing files.

1

solved Python. Copy Files and Folders to existing directory [closed]