def METHOD_NAME(self, options):
    """Recurse through directories and return files to be processed."""
    dirstack = [""]
    join = os.path.join
    templatefiles = []
    while dirstack:
        top = dirstack.pop(-1)
        names = os.listdir(join(options.template, top))
        dirs = []
        for name in names:
            filepath = join(top, name)
            fullfilepath = join(options.template, filepath)
            # handle directories...
            if os.path.isdir(fullfilepath):
                dirs.append(filepath)
            elif os.path.isfile(fullfilepath):
                if not self.isvalidtemplatename(name):
                    # only handle names that match recognized output
                    # file extensions
                    continue
                templatefiles.append(filepath)
        # make sure the directories are processed next time round.
        dirs.reverse()
        dirstack.extend(dirs)
    return templatefiles