chickadee » pathfinder » dirent-stat

dirent-stat DIRENT FILENAMEprocedure

Return the stat vector for FILENAME in DIRENT. If the stat fails (for example, if the file has gone missing since the dirent was populated) then #f is returned. Stat vectors are cached upon first access and subsequent stats are returned from cache.

(use posix-extras)
(define (pf:nonempty-file? de fn)
  (and-let* ((s (dirent-stat de fn)))
    (and (stat-regular-file? s)    ;; or, (pf:regular-file? de fn)
         (> (stat-size s) 0))))

(path-find pf "notes.txt" pf:exact pf:nonempty?)