def folder_2_name(path_folder):
    """ Given a path to a folder, obtains the file name (without format
    extension).

    :param path_folder: Path to a folder.
    :type path_folder: str
    :return: Name of file
    :rtype: str
    |
    :Example:
        >>> from pyphoon.utils import folder_2_name
        >>> folder_2_name("path/to/folder")
        'folder'
    """
    name = path_folder.split('/')[-1]
    if name == '':
        name = path_folder.split('/')[-2]
    return name
