1import shutil
2shutil.copy2('/src/dir/file.ext', '/dst/dir/newname.ext') # complete target filename given
3shutil.copy2('/src/file.ext', '/dst/dir') # target filename is /dst/dir/file.ext
1import shutil
2
3original = r'original path where the file is currently stored\file name.file extension'
4target = r'target path where the file will be copied\file name.file extension'
5
6shutil.copyfile(original, target)
7
1# Source path
2src = 'C:/Users / Rajnish / Desktop / GeeksforGeeks / source'
3
4# Destination path
5dest = 'C:/Users / Rajnish / Desktop / GeeksforGeeks / destination'
6
7# Copy the content of
8# source to destination
9destination = shutil.copytree(src, dest)