So I want to use find to return a list of all .html files in a given directory that have been last modified on a Monday. How can I do this?
Find all files that have been last modified on a specific day - like Monday?
find;date
I'm not sure of a good way to do this directly using only find or similar, but you can use find and grep:find -printf '%Tw:%h/%f\0' | grep -z '^1:'Since it's find, you can of course combine other flags:find -name '*.html' -type f -printf '%Tw:%h/%f\0' | grep -z '^1:'to get only files ending with .html.ExplanationHere is my test directory:$ ls -latotal 68drwxr-xr-x  2 anthony anthony  4096 Mar 24 17:53 .drwxrwxrwt 98 root    root    61440 Mar 24 17:55 ..-rw-r--r--  1 anthony anthony     0 Mar 24 17:53 monday-rw-r--r--  1 anthony anthony     0 Mar 23 11:12 sundayfind's -printf argument takes a format string. Here, %T means last modified time. The w after it means the day of the week, from 0 (Sunday) through 6 (Saturday). You can get the name with a (abbreviated: Mon) or A (full: Monday), but those are locale-specific. : gives a literal :. %h/%f is the path and file name. \0 null-separates the entries (like -print0 does).So that prints out something like 1:./.<NULL>0:./sunday<NULL>1:./monday<NULL>, which if you replace the NULL with newline for readability with tr '\0' '\n' is:1:./.0:./sunday1:./mondayThen grep -z '^1:' looks for things starting with 1:, which is Monday.