From 42335e2759d1a434c41aca8cd0981b6bc7d15cc8 Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Fri, 15 Jan 2021 13:38:36 +0100 Subject: [PATCH] ambrevar/file: Add match-date< and match-date> helpers. --- .local/share/common-lisp/source/ambrevar/file.lisp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.local/share/common-lisp/source/ambrevar/file.lisp b/.local/share/common-lisp/source/ambrevar/file.lisp index f326a842..0844a2a8 100644 --- a/.local/share/common-lisp/source/ambrevar/file.lisp +++ b/.local/share/common-lisp/source/ambrevar/file.lisp @@ -133,3 +133,13 @@ Without PREDICATES, list all files." Without PREDICATES, list all files." (let ((*finder-include-directories* nil)) (apply #'walk root predicates))) + +(defun match-date< (timestamp) + "Return a file predicate that matches on modification time #'< than timestamp." + (lambda (file) + (local-time:timestamp< (modification-date file) timestamp))) + +(defun match-date> (timestamp) + "Return a file predicate that matches on modification time #'> than timestamp." + (lambda (file) + (local-time:timestamp> (modification-date file) timestamp)))