[GRASS-user] List files and count

Greetings

I need to find, in a certain mapset, a list of files with a name that match a certain string and count them. How can I do this? I'm implementing this in a Py Script

Thanks
Antonio

__________ Information from ESET NOD32 Antivirus, version of virus signature database 5774 (20110110) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

António Rocha wrote:

I need to find, in a certain mapset, a list of files with a name that
match a certain string and count them. How can I do this? I'm
implementing this in a Py Script

grass.script.mlist() provides an interface to g.mlist, although it
only supports glob patterns and not regexps. If you need regexps:

def mlist(type, pattern = None, mapset = None):
    result = list()
    for line in read_command("g.mlist",
                             flags = 'r',
                             type = type,
                             pattern = pattern,
                             mapset = mapset).splitlines():
        result.append(line.strip())
    return result

--
Glynn Clements <glynn@gclements.plus.com>