I don't see anything that handles file metadata other than the name.
That's exactly the purpose of command dired-mark-sexp
. Use a Lisp sexp to match files, where the sexp can use (pseudo-)variables whose values are file metadata values.
You can use the command interactively or use it or some of its code from Lisp.
You can use (pseudo-)variable time
in the sexp you use for marking -- compare some given time with the value of time
for each file.
Here's the doc string. (This is the doc for the version from Dired+, which enhances the vanilla version in relatively minor ways -- you can use the vanilla version for what you want just as easily.)
dired-mark-sexp
is an interactive compiled Lisp function in
dired+.el
.
It is bound to M-(
, * (
, menu-bar mark marks-mark marks-mark-sexp
.
(dired-mark-sexp PREDICATE &optional UNMARK-P)
Mark files for which PREDICATE returns non-nil
.
With a prefix arg, unmark or unflag those files instead.
PREDICATE
is a lisp sexp that can refer to the following symbols as
variables:
mode
[string] file permission bits, e.g. "-rw-r--r--"
nlink
[integer] number of links to file
size
[integer] file size in bytes
uid
[string] owner
gid
[string] group (If the gid
is not displayed by ls
,
this will still be set (to the same as uid
))
time
[string] the time that ls
displays, e.g. "Feb 12 14:17"
name
[string] the name of the file
sym
[string] if file is a symbolic link, the linked-to name,
else ""
inode
[integer] the inode of the file (only for ls -i
output)
blks
[integer] the size of the file for ls -s
output
(ususally in blocks or, with -k
, in Kbytes)
Examples:
Mark zero-length files: `(equal 0 size)'
Mark files last modified on Feb 2: `(string-match "Feb 2" time)'
Mark uncompiled Emacs Lisp files (.el' file without a
.elc' file):
First, Dired just the source files: dired *.el
.
Then, use M-(
with this sexp:
`(not (file-exists-p (concat name "c")))`
There's an ambiguity when a single integer not followed by a unit
prefix precedes the file mode: It is then parsed as inode number
and not as block size (this always works for GNU coreutils ls
).
Another limitation is that the uid
field is needed for the
function to work correctly. In particular, the field is not
present for some values of ls-lisp-emulation
.
This function operates only on the Dired buffer content. It does not
refer at all to the underlying file system. Contrast this with
find-dired
, which might be preferable for the task at hand.