Python Module shutil: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 9: | Line 9: | ||
=Recursively Copy a Directory= | =Recursively Copy a Directory= | ||
<syntaxhighlight lang='python'> | |||
import shutil | import shutil | ||
Revision as of 20:21, 2 March 2022
External
Internal
Overview
The shutil
module offers high-level operations on files and collections of files. In particular, functions are provided which support file copying and removal. For operations on individual files, see also the os
module.
Recursively Copy a Directory
import shutil
shutil.copytree(src, dst, symlinks=False, ignore=None, copy_function=copy2, ignore_dangling_symlinks=False, dirs_exist_ok=False)
Organizatorium
from shutil import which
for i in m:
print("{:20}{:7}".format(m[i], "OK" if which(i) else "missing"))