I missed sending this to SRFI 170.

---------- Forwarded message ---------
From: John Cowan <xxxxxx@ccil.org>
Date: Tue, Sep 3, 2019 at 5:56 PM
Subject: Re: Outstanding issue: directory-files in the context of huge directories
To: <xxxxxx@ancell-ent.com>


So here's the generator:

(define make-directory-files-generator
  (case-lambda
    ((dir dot-files?) (make-directory-files-generator* dir dot-files?))
    ((dir) (make-directory-files-generator* dir #f))))

(define (make-directory-files-generator* dir dot-files?)
  (let ((dir-obj (open-directory dir dot-files?))
          (eof (eof-object)))
    (lambda ()
      (let ((f (read-directory dir-obj)))
        (if (eq? f eof) (close-directory dir-obj))
        f))))


I haven't actually tested this, but it's at least conceptually correct. 

Although this overlaps the utility of directory-files, I want to preserve the latter (and Harold agrees).  When WG1 voted on the issue, directory-files was the highest-ranking result in the STV voting; however, it did not command a majority of the votes cast, which is why it does not appear in R7RS-small.