def copy(src, dest, ignore_patterns=[]):
try:
shutil.copytree(
src, dest,
ignore=shutil.ignore_patterns(
*ignore_patterns))
except OSError as e:
# If the error was caused because the source wasn't a directory
if e.errno == errno.ENOTDIR:
shutil.copy(src, dest)
else:
print(' Directory not copied. Error: %s' % e)
评论列表
文章目录