blob: 6697b6e43179ee2e5ac00b54870d024a2c5a757b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
from pathlib import Path
import shutil
def rm_rf(*paths: Path):
for path in paths:
if not path.exists():
continue
if path.is_dir():
shutil.rmtree(str(path), ignore_errors=True)
else:
path.unlink()
def cp_r(src: Path, dest: Path):
if src.is_dir():
shutil.copytree(str(src), str(dest), dirs_exist_ok=True)
else:
shutil.copy2(str(src), str(dest))
|