def copy2(src, dst):
"""
Similar to shutil.copy(), but metadata (permissions etc., as mentioned in
copy_stat above) is copied as well in fact, this is just shutil.copy()
followed by copystat(). This is similar to the Unix command cp -p.
:Arguments:
src - file and metadata to be copied
dst - file/dir on which to be copied
:Return:
True/False - based on the success/failure of the operation
"""
status = False
try:
shutil.copy2(src, dst)
print_info("src {} copied to dst {} successfully along with metadata".
format(src, dst))
status = True
except Exception as e:
print_error("copying file {} with metadata to file {} raised exception"
" {}".format(src, dst, str(e)))
return status
评论列表
文章目录