Answers for "python copy file with directory structure"


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
Posted by: Guest on February-22-2021

python copy dir

from shutil import copytree
shutil.copytree("sourcedir", "destination")
Posted by: Guest on February-26-2021

Code answers related to "python copy file with directory structure"

Python Answers by Framework

Browse Popular Code Answers by Language