def move_folder(src_path, dst_path, new_folder_name=None):
"""
This helper function is aimed to copy a folder from a source path to a destination path,
eventually renaming the folder to be moved. If it fails, it does it silently.
:param src_path: absolute or relative source path
:param dst_path: absolute or relative destination root path
:param new_folder_name: new name for the source path's folder
"""
src_path, dst_path = __expand_folders(src_path, dst_path)
if new_folder_name is not None:
dst_path = join(dst_path, new_folder_name).rstrip("/")
try:
if src_path != dst_path:
sh.mv(src_path, dst_path)
except sh.ErrorReturnCode_1:
pass
评论列表
文章目录