>> On Sat 16 May 2026 at 14:56:30 (-0400), Karen Lewellen wrote:

> Hi Greg,
> I have no issues using find. I simply have never heard of the option until
> now, as my Linux access is only via shell services. [...]
> where would the date be added, and where does that land in the syntax?

Greg's "find" examples showed up as I was writing my reply; this just
gives some context.

Here's a list of the HTML files in one of my project directories:

  me% cd /home/vogelke/projects/html-dir/

  me% ls -l *.htm
  -rw-r--r--  1 vogelke  mis   325 Dec 13 05:39 FOOTER.htm
  -rw-r--r--  1 vogelke  mis   464 Dec 13 05:39 HEADER.htm
  -rw-r--r--  1 vogelke  mis  6218 Jan 31  2025 example.htm
  -rw-r--r--  1 vogelke  mis  6708 Dec 13 05:57 index.htm
  -rw-r--r--  1 vogelke  mis   587 Dec 13 05:42 tree.htm
  -rw-r--r--  1 vogelke  mis  7766 Dec  6 02:40 wanted.htm

If you're on a Linux system like Debian that has the GNU tools installed,
you can make "ls" be more specific about the modified date and time:

  me% ls -l '--time-style=+%d-%b-%Y %T' *.htm
  -rw-r--r-- 1 vogelke mis  325 13-Dec-2025 05:39:34 FOOTER.htm
  -rw-r--r-- 1 vogelke mis  464 13-Dec-2025 05:39:30 HEADER.htm
  -rw-r--r-- 1 vogelke mis 6218 31-Jan-2025 20:16:22 example.htm
  -rw-r--r-- 1 vogelke mis 6708 13-Dec-2025 05:57:42 index.htm
  -rw-r--r-- 1 vogelke mis  587 13-Dec-2025 05:42:47 tree.htm
  -rw-r--r-- 1 vogelke mis 7766 06-Dec-2025 02:40:24 wanted.htm

If you want to search for a date or a range of dates, then the other
people in this thread are right -- use "find".  Always put the string
you're looking for in quotes, or else your shell might replace (say)
*.txt with only the files named *.txt in your current directory.

"find" accepts the directory you're interested in as the first argument,
which in this case is the current directory:

  me% find . -name '*.htm' -print
  ./wanted.htm
  ./FOOTER.htm
  ./tree.htm
  ./index.htm
  ./example.htm
  ./HEADER.htm

Notice that (unlike ls output) the files aren't sorted.  That's because
"find" reads them in the order they were created on disk.  You can add
additional information by using "-printf":

  me% find . -name '*.htm' -printf "%TF %TT %p\n"
  2025-11-06 02:40:24 ./wanted.htm
  2025-12-13 05:39:34 ./FOOTER.htm
  2025-12-13 05:42:47 ./tree.htm
  2025-12-13 05:57:42 ./index.htm
  2025-01-31 20:16:22 ./example.htm
  2025-12-13 05:39:30 ./HEADER.htm

Since the modification dates are printed in ISO format (YYYY-MM-DD),
sensible sorting is much easier:

  me% find . -name '*.htm' -printf "%TF %TT %p\n" | sort
  2025-01-31 20:16:22 ./example.htm
  2025-11-06 02:40:24 ./wanted.htm
  2025-12-13 05:39:30 ./HEADER.htm
  2025-12-13 05:39:34 ./FOOTER.htm
  2025-12-13 05:42:47 ./tree.htm
  2025-12-13 05:57:42 ./index.htm

You can certainly use the -mtime option, but "grep" might also do the trick.
If you wanted files between January and September of 2025:

  me% find . -name '*.htm' -printf "%TF %TT %p\n" | sort | grep 2025-0
  2025-01-31 20:16:22 ./example.htm

If you wanted files after September of 2025 (month number starts with 1):

  me% find . -name '*.htm' -printf "%TF %TT %p\n" | sort | grep 2025-1
  2025-11-06 02:40:24 ./wanted.htm
  2025-12-13 05:39:30 ./HEADER.htm
  2025-12-13 05:39:34 ./FOOTER.htm
  2025-12-13 05:42:47 ./tree.htm
  2025-12-13 05:57:42 ./index.htm

You can do all sorts of bizarre things with "find" and "grep".
Hope this helps.

-- 
Karl Vogel                      I don't speak for anyone but myself

Comment: But I'm not a tech person!
Reply: I'm not a mechanic, but if the engine suddenly sounds like a live
       cat being fed into a garbage disposal, I know enough to pull over.
                                    --Seen on Reddit, 8 May 2026

Reply via email to