def move_files(src_path, dst_path, *files):
"""
This helper function is aimed to move files from a source path to a destination path.
:param src_path: absolute or relative source path
:param dst_path: absolute or relative destination path
:param files: tuples with the following format (source_filename, destination_filename)
"""
src_path, dst_path = __expand_folders(src_path, dst_path)
for f in files:
if isinstance(f, tuple):
src, dst = f
elif isinstance(f, string_types):
src, dst = 2 * [f]
else:
continue
src, dst = join(src_path, src), join(dst_path, dst)
try:
if src != dst:
sh.mv(src, dst)
except sh.ErrorReturnCode_1:
pass
评论列表
文章目录