This solves filtering in lisp using association list tools.
Common Lisp has its own wildcard stuff #p"foo/*.*"
|#
(defun do-nothing (s c) "
Placed in tmp *readtable* for #\- and #\_
" (declare (ignore c))
(read s t nil t))
(defmacro decode-unix-time (time &aux (fields
'(sec min hou day month yea))) "
(decode-universal-time (+ time 2208970800))
2208970800 seconds seem to be the difference.
Off by one hour since I made this in daylight savings time."
`(multiple-value-bind ,fields
(decode-universal-time (+ ,time 2208970800))
(pairlis '(,@fields)
,(append '(list) fields))))
(defmacro comprehend-path-name (name) "
(comprehend-namestring name)
name is actually the string from (pathname-name path) "
`(let ((*readtable* (copy-readtable nil)))
(set-macro-character #\- #'do-nothing)
(set-macro-character #\_ #'do-nothing)
(with-input-from-string (in ,name)
(loop for no = (handler-case (read in nil nil) (end-of-file (e) nil))
for field in '(tgid unix-time location? unused index)
while no collect `(,field . ,no)))))
(defun comprehend-directory (dir &aux (files (directory dir)))
(loop for file in files
for namestring = (file-namestring file)
for path-name = (pathname-name file)
for alist = (comprehend-path-name path-name)
for time = (decode-unix-time
(cdr (assoc 'unix-time alist)))
collect (append `((namestring . ,namestring)
(decoded-time . ,time))
alist)))