On 10/13/25 04:31, raf wrote:
Hi, That sounds like the correct behaviour to me. It
sounds like you are expecting "newer" to mean
the-same-as-or-newer when it just means "newer" (i.e.
">=" rather than ">" as documented). The manual entry
says:

   -newer reference
     Time of the last data modification of the current file is more
     recent than that of the last data modification of the reference
     file.

   -newerXY reference
     Succeeds if timestamp X of the file being considered is newer than 
timestamp Y of the file reference.

It says "more recent than" and "newer". Both say "greater than" to me.

Right, all -newer options mean really "greater", i.e., not "greater or equal",
and there's no option to check for equality, unfortunately.

Actually, forget all that. Since you are using
-newermt, it just requires that find's time
specification notation supports nsec and it looks like
it does:

   
https://www.gnu.org/software/findutils/manual/html_mono/find.html#Date-input-formats

Shows this example:

   $ date --rfc-3339=ns  # --rfc-3339 is a GNU extension.
   2022-11-14 21:02:42.000000000-05:00

So maybe you can do:

   find . -newermt '2009-12-31 23:59:59.999999999-05:00'

adjusted for your own timezone. I just checked it and it worked. Yay!

   $ touch -m -d "2010-01-01 00:00:00" example.txt
   $ find example.txt -newermt '2009-12-31 23:59:59.999999999+11:00'
   example.txt

Nice suggestion, thanks.

This topic also reminds me that -newerXY does not yet show up in --help output.
The attached fixes it, plus a minor typo fix with the other patch.
Pushing soon.

Have a nice day,
Berny
From 1c39dc60559a466093b00292dd83b8ca1cac02e8 Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <[email protected]>
Date: Mon, 13 Oct 2025 22:09:28 +0200
Subject: [PATCH 1/2] find: fix minor typo in --help output

* find/util.c (usage): Terminate sentence about -D with a dot.
(show_valid_debug_options): While at it, add indentation for -D values.
---
 find/util.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/find/util.c b/find/util.c
index b22e6e7b..75f99d09 100644
--- a/find/util.c
+++ b/find/util.c
@@ -148,7 +148,7 @@ show_valid_debug_options (int full)
     {
       for (i=0; i<N_DEBUGASSOC; ++i)
         {
-          fprintf (stdout, "%s%s", (i>0 ? ", " : ""), debugassoc[i].name);
+          fprintf (stdout, "%s%s", (i>0 ? ", " : "      "), debugassoc[i].name);
         }
     }
 }
@@ -206,7 +206,7 @@ Other common options:\n"));
 
   show_valid_debug_options (0);
   HTL (_("\n\
-Use '-D help' for a description of the options, or see find(1)\n\
+Use '-D help' for a description of the options, or see find(1).\n\
 \n"));
 
   explain_how_to_report_bugs (stdout, program_name);
-- 
2.51.0

From 74d25ac58de275e004a1fe71af4afcb8bc51fbfd Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <[email protected]>
Date: Mon, 13 Oct 2025 22:15:09 +0200
Subject: [PATCH 2/2] find: document -newerXY in --help output

* find/util.c (usage): Add above find(1) option, and briefly explain
that XY stands for the combination [aBcm][aBcmt].
---
 find/util.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/find/util.c b/find/util.c
index 75f99d09..d8f2d019 100644
--- a/find/util.c
+++ b/find/util.c
@@ -188,8 +188,8 @@ Tests (N can be +N or -N or N):\n\
       -ctime N -empty -false -fstype TYPE -gid N -group NAME -ilname PATTERN\n\
       -iname PATTERN -inum N -iwholename PATTERN -iregex PATTERN\n\
       -links N -lname PATTERN -mmin N -mtime N -name PATTERN -newer FILE\n\
-      -nouser -nogroup -path PATTERN -perm [-/]MODE -regex PATTERN\n\
-      -readable -writable -executable\n\
+      -newerXY REFERENCE -nouser -nogroup -path PATTERN -perm [-/]MODE\n\
+      -regex PATTERN -readable -writable -executable\n\
       -wholename PATTERN -size N[bcwkMG] -true -type [bcdpflsD] -uid N\n\
       -used N -user NAME -xtype [bcdpfls]\n"));
   HTL (_("\n\
@@ -204,6 +204,10 @@ Other common options:\n"));
   HTL (_("      --help                   display this help and exit\n"));
   HTL (_("      --version                output version information and exit\n\n"));
 
+  HTL (_("\n\
+In -newerXY, XY stands for the combination [aBcm][aBcmt]; see find(1).\n\
+\n"));
+
   show_valid_debug_options (0);
   HTL (_("\n\
 Use '-D help' for a description of the options, or see find(1).\n\
-- 
2.51.0

Reply via email to