File I want to find.
20200521-285353-rpi3-4497-00-0-13-0-0-0-0-n.jpg Files with Date in the filename from 2020-01-01 to 2020-09-31
My regex string:
Find version: find (GNU findutils) 4.7.0-git
I can't find a combination that works. My attempts:
find . -type f -regextype grep -regex '20200[1-9]-*.*'
find . -type f -regex '^20200[0-9][0-9][0-9]\-[0-2].*'
find . -type f -regextype sed -regex '^20200[0-9][0-9][0-9]\-[0-2].*'
-regexis a whole path match. So for example your second attempt would match if you replaced
^at the start with
.*/(although the escaping of
-is not necessary). This behavior is different from that of
-namewhich (as well as being a glob match rather than a regex) matches against the file name only.
￼20200521.txtbe found? How about
2020071128847297923497432-4234y9234-foo-bar? We need to know the exact parameters to help you.
\-was in your original version. If you feel your question has been edited wrongly, please do fix it