I've files in a folder like
file_2017-01-01.jpg
file_2017-02-20.jpg
file_2017-05-10.jpg
file_2017-09-01-jpg
file_2017-10-25.jpg
file_2017-11-04.jpg
file_2017-12-22.jpg
How can I use the find command to list files from file_2017-01*
to file_2017-10*
?
find . -regextype posix-awk -regex ".*2017-[01-10]*"
doesn't work.
Also not, find . -maxdepth 1 -type f -name "*2017-[01-10]*"
A character class only matches one character at a time, so on its own, it's not an adequate tool for the job in question. Consider instead:
This has two branches:
0[1-9]
, matching any two-character string from 01 through 09; and10
, matching only the exact string10
.