[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Function: rcd-find-latest-pictures-in-directory
From: |
Jean Louis |
Subject: |
Function: rcd-find-latest-pictures-in-directory |
Date: |
Thu, 05 Dec 2024 16:29:40 +0300 |
I have just finished this function and find it very interesting:
(defun rcd-find-latest-pictures-in-directory (directory &optional count)
"Return the latest .webp, .png, .jpg or .jpeg picture in DIRECTORY.
Optional COUNT will return only specified number of pictures."
(let* ((files (directory-files directory t "\\.\\(webp\\|png\\|jpe?g\\)$" t))
(latest-files (sort files
(lambda (a b)
(time-less-p (nth 5 (file-attributes b))
(nth 5 (file-attributes a)))))))
(cond (count (seq-take latest-files count))
(t latest-files))))
It will be used to quickly fetch latest downloaded picture, sort it
somewhere, optimize it for the website, and upload it. It is for
workflow optimization.
Jean Louis
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Function: rcd-find-latest-pictures-in-directory,
Jean Louis <=