copy files from one directory to another python code example
Example 1: copy files python
from shutil import copyfile
copyfile(src, dst)
Example 2: python copy file to another directory
import shutil
shutil.copy2('/src/dir/file.ext', '/dst/dir/newname.ext')
shutil.copy2('/src/file.ext', '/dst/dir')
Example 3: copy directory from one location to another python
src = 'C:/Users / Rajnish / Desktop / GeeksforGeeks / source'
dest = 'C:/Users / Rajnish / Desktop / GeeksforGeeks / destination'
destination = shutil.copytree(src, dest)
Example 4: copyfile pyhon
from shutil import copyfile
copyfile(src, dst)