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
import shutil
import os
# path to source directory
src_dir = 'fol1'
# path to destination directory
dest_dir = 'fol2'
# getting all the files in the source directory
files = os.listdir(src_dir)
shutil.copytree(src_dir, dest_dir)
from distutils.dir_util import copy_tree
# copy subdirectory example
from_directory = "/a/b/c"
to_directory = "/x/y/z"
copy_tree(from_directory, to_directory)