(path: Path)
Remove a file and if the dir is empty remove it
Remove a file and if the dir is empty remove it
Remove a file and if the dir is empty remove it
def unlink_parent_dir(path: Path) -> None:
    """Remove a file and if the dir is empty remove it"""
    logger.info(f"unlink {str(path)}")
    path.unlink()

    parent_path = path.parent
    try:
        parent_path.rmdir()
        logger.info(f"rmdir {str(parent_path)}")
    except OSError as oe:
        logger.debug(f"Did not remove {str(parent_path)}: {str(oe)}")
def unlink_parent_dir ( path : Path ) -> None : logger . info ( f"unlink {str(path)}" ) path . unlink ( ) parent_path = path . parent try : parent_path . rmdir ( ) logger . info ( f"rmdir {str(parent_path)}" ) except OSError as oe : logger . debug ( f"Did not remove {str(parent_path)}: {str(oe)}" )