Python Bekerja dengan File dan Dir
from pathlib import Path
import shutil
tmp = Path("/tmp")
src = tmp.joinpath("src")
src.mkdir()
src.joinpath("src.txt").touch()
# /tmp/src
# /tmp/src/src.txt
dst = tmp.joinpath("dst")
dst.mkdir()
# /tmp/dst
shutil.copytree(src, dst)
# FileExistsError: [Errno 17] File exists: '/tmp/dst'
shutil.copytree(src, dst, dirs_exist_ok=True)
# PosixPath('/tmp/dst')
Puzzled Puffin