Consider dates in the ISO 8601 format i.e. YYYY-MM-DD, e.g. 2015-01-28, and say we have a folder with files of the form:AAAA_<date>_BBBBI am looking for a glob pattern in zsh (or Bash) that I could use to specify files between two dates. For example, say I want to copy files between 2014-12-15 and 2015-02-03. Is there an easy way to build a glob expression to refer to files between those two dates (including them)?The following may help (from lexicographical order):An important exploitation of lexicographical ordering is expressed in  the ISO 8601 date formatting scheme, which expresses a date as  YYYY-MM-DD. This date ordering lends itself to straightforward  computerized sorting of dates such that the sorting algorithm does not  need to treat the numeric parts of the date string any differently  from a string of non-numeric characters, and the dates will be sorted  into chronological order.
Filename expansion from date ranges
bash;files;zsh;wildcards
It is good you tagged the question with zsh, since in that shell you can use extensive glob qualifiers including test done on file names:$ ls -1 AAAA*AAAA_2012-10-03_BBBBAAAA_2014-12-28_BBBBAAAA_2015-01-03_BBBBAAAA_2015-02-03_BBBBAAAA_2015-10-03_BBBB$ d1='2014-12-15'$ d2='2015-02-03'$ print -l *(e:'[[ ${${REPLY#*_}%_*} > $d1 && ${${REPLY#*_}%_*} < $d2 ]]':)AAAA_2014-12-28_BBBBAAAA_2015-01-03_BBBBNote that for the given date format you can perform simple string comparison.I assumed here, that your files are named AAAA_date_BBBB as in the question and extracted the date part with parameter expansion. You would probably need to modify this code to get date in suitable way for your real case scenario.