'Collect the directory listing and store in the datastore.'

@flow.StateHandler()
def List(self, responses):

    if (not responses.success):
        raise flow.FlowError(str(responses.status))
    self.Status('Listed    %s', self.state.urn)
    fd = aff4.FACTORY.Create(self.state.urn, standard.VFSDirectory, mode='w', token=self.token)
    fd.Set(fd.Schema.PATHSPEC(self.state.stat.pathspec))
    fd.Set(fd.Schema.STAT(self.state.stat))
    fd.Close(sync=False)
    for st in responses:
        st = rdf_client.StatEntry(st)
        CreateAFF4Object(st, self.client_id, self.token, sync=False)
        self.SendReply(st)
    aff4.FACTORY.Flush()
