def lcopy(src, dst, no_hardlinks=False):
try:
if issymlink(src):
linkto = os.readlink(src)
os.symlink(linkto, dst)
return True
else:
if no_hardlinks:
shutil.copy(src, dst)
else:
hardlink(src, dst)
return False
except EnvironmentError as err:
if err.errno == errno.EEXIST:
os.unlink(dst)
return lcopy(src, dst)
raise
评论列表
文章目录