upon further reflection and experimentation, it seems like the easier
solution to the referenced issue is the following (instead of a code patch):
env TIME_STYLE='+%s' find ~/Documents -exec ls -ld \{\} \+
one could alternatively invoke the ls command's parameter:
find ~/Documents -exec ls --time-style='+%s' -ld \{\} \+
and the invocation of ls directly will of course already include any
predefined format-strings:
find ~/Documents -exec ls --time-style=full-iso -ld \{\} \+
I do think it might be handy to have a parameter to coërce the -ls time
output from find into something sortable, like
find . -type f -ls -epoch
without involving the user having to write any explicit formatting
strings at all; but this probably isn't a common enough usecase to
justify introducing an entirely new parameter to find. Maybe an update
to the documentation for -ls, though? suggesting -exec ls if the full
features of the ls command are necessary?
-Matt
On 11/15/25 13:05, Bernhard Voelker wrote:
On 11/15/25 17:33, James Youngman wrote:
I think if someone requires a specific output format, then they should
specify the format they want with (for example) -printtf.
excellent point - how could I have forgotten about -printf?
If the capabilities of -printf are insufficient to reproduce the
effect of, say, -ls, then we should improve it[*]. This general
problem is why the -printf documentation says:
%{ %[ %(
Reserved for future use.
See commit 9cb1805e619b0f3aebd0984856de24964218bce2 of 2011-06-2011.
If we're going to use one or more of these reserved sequences, I would
like one of them to be for user-specified extensions (since that's the
kind of use I had in mind when I reserved them).
yes, one of the nice things about the --time-style option in ls(1) and
du(1) are the predefined styles like "full-iso".
Those could eventually be achieved with "%{ %[ %(", but the problem
is that the time-style tells how to format, but now which of the
timestamps: atime, btime, ctime, mtime.
Maybe something like %{mtime:full-iso} but this also doesn't look ideal.
There's many possibilities, even e.g. -ls-full-iso or alike.
FWIW: there was a -lsh suggestion to print as in 'ls -dilsh' in human
readable format a while ago.
Anyway, I think with the above argument about the existing functionality
in -printf, which would be redundant to the current time-style
suggestion,
we can close the issue, right?
https://savannah.gnu.org/bugs/index.php?66299
Have a nice day,
Berny