def getTroveFiles(self, troveList, onlyDirectories = False):
        instanceIds = self._lookupTroves(troveList)
        if None in instanceIds:
            raise KeyError

        trvByInstanceId = dict([ (instId, trvInfo) for
                instId, trvInfo in itertools.izip(instanceIds, troveList)
                if instId is not None ])
        instanceIds = trvByInstanceId.keys()

        cu = self.db.cursor()

        cu.execute("""CREATE TEMPORARY TABLE getTrovesTbl(
                                idx %(PRIMARYKEY)s,
                                instanceId INT)
                   """ % self.db.keywords, start_transaction = False)

        cu.executemany("INSERT INTO getTrovesTbl VALUES (?, ?)",
                       list(enumerate(instanceIds)), start_transaction=False)

        if onlyDirectories:
            dirClause = "AND stream LIKE 'd%'"
        else:
            dirClause = ""

        cu.execute("""SELECT instanceId, path, stream FROM getTrovesTbl JOIN
                        DBTroveFiles USING (instanceId)
                        WHERE isPresent = 1 %s
                        ORDER BY path""" % dirClause)

        lastId = None
        for instanceId, path, stream in cu:
            yield trvByInstanceId[instanceId], path, stream

        cu.execute("DROP TABLE getTrovesTbl", start_transaction = False)