<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def getIndex(folderPath=None):
 """parse the 'Maps' subfolder directory divining criteria for valid maps"""

    try:    return cache.structure
    except AttributeError: pass # if it doesn't exist, generate and cache the map file data
    if folderPath == None:
        from sc2maptool.startup import setup
        folderPath = setup()
    ############################################################################
    def folderSearch(path, attrList=[]):
        ret = []
        for item in glob(os.path.join(path, '*')):
            if item == os.sep: continue
            itemName = os.path.basename(item)
            if   os.path.isdir(item):               ret += folderSearch(item, attrList + [itemName])
            elif itemName.endswith(c.SC2_MAP_EXT):  ret.append( MapRecord(itemName, item, attrList) )
        return ret
    ############################################################################
    cache.structure = folderSearch(folderPath)
    return cache.structure