from pathlib import Path


def doRelocateFile(src, dst, overwrite=False):
    """
    Relocate file `src` to the path `dst`.

    If dirname(dst) is not exist yet, mkdir'ed silently.

    If file is already exist as `dst`, raise ``FileExistsError``, unless
    ``overwrite=True``.

    Parameter
    ---------
    s : path-like: source file
    d : path-like: destination file
    overwrite(optional) : logical : overwrite file in destination, or not.

    Return
    ------
    path-like : pathname of relocated file.

    """

    sf = Path(src)
    df = Path(dst)

    if (df.is_file()):
        if overwrite:
            pass
        else:
            raise FileExistsError(f'destination is existing file: {df}')

    print(sf, '->', df)

    df.parent.mkdir(parents=True, exist_ok=True)
    sf.replace(df)

    return df