python copy dir to another dir code example
Example 1: copy whole directory python
import shutil
shutil.copytree(source, destination)
Example 2: python copy file to another directory
import shutil
shutil.copy2('/src/dir/file.ext', '/dst/dir/newname.ext') # complete target filename given
shutil.copy2('/src/file.ext', '/dst/dir') # target filename is /dst/dir/file.ext
Example 3: python copy dir
from shutil import copytree
shutil.copytree("sourcedir", "destination")