file_Utils.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:warriorframework 作者: warriorframework 项目源码 文件源码
def move(src, dst):
    """
    Recursively move a file or directory (src) to another location (dst).
    If the destination is an existing directory, then src is moved inside that
    directory. If the destination already exists but is not a directory, it may
    be overwritten depending on os.rename() semantics.If the destination is on
    the current filesystem, then os.rename() is used. Otherwise, src is copied
    (using shutil.copy2()) to dst and then removed.
    :Arguments:
        src - source file to be moved
        dst - target file/directory on which to be moved
    :Return:
        True/False - based on the success/failure of the operation
    """
    status = False
    try:
        shutil.move(src, dst)
        print_info("move of src {} to dst {} successful".format(src, dst))
        status = True
    except Exception as e:
        print_error("moving file {} to file {} raised exception {}".
                    format(src, dst, str(e)))
    return status
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号