def restore_junction(old_path, new_path): if os.path_exists(new_path): if os.path_exists(old_path): if junction.isjunction(old_path): print("Already junctioned: {}".format(old_path)) else: print("Cannot junction; conflicting folder already exists: {}".format(old_path)) else: link_save(old_path, new_path) hide_directory(old_path)
def move_and_junction(old_path, new_path): if os.path.exists(old_path): if not junction.isjunction(old_path): if os.path.exists(new_path): print("Can't move {}".format(old_path)) print("Conflicting folder already exists: {}".format(new_path)) return move_save(old_path, new_path) link_save(old_path, new_path) hide_directory(old_path) else: print("Already junctioned: {}".format(old_path))
def isLink(path): return junction.isjunction(path)
def is_symlink(source): if os.path.isdir(source): ret = junction.isjunction(source) return ret return hardlink.is_hardlink(source)