MCPcopy Create free account
hub / github.com/ActiveState/code / copy_file

Function copy_file

recipes/Python/579020_smart_copy/recipe-579020.py:1–6  ·  view source on GitHub ↗
(glob, dst_dir, src_dir=Path('.'))

Source from the content-addressed store, hash-verified

1def copy_file(glob, dst_dir, src_dir=Path('.')) :
2 for src_pth in src_dir.glob(glob) :
3 dst_pth = dst_dir / src_pth.relative_to(src_dir)
4 if src_pth.is_file() and not dst_pth.parent.exists() :
5 dst_pth.parent.mkdir(parents=True)
6 shutil.copy(str(src_pth), str(dst_pth))

Callers

nothing calls this directly

Calls 5

strFunction · 0.85
mkdirMethod · 0.80
is_fileMethod · 0.45
existsMethod · 0.45
copyMethod · 0.45

Tested by

no test coverage detected