I have a directory structure Year-month-date name:
2021-05-02 Linus
2021-04-02 Jay
2021-07-03 Sara
etc...
Now I´d like to loop over all directories with month <6 and run a script. Without the condition I do the following, but cannot figure out how to condition..
for f in ./*; do (cd "$f"; printf "file '%s'\n" *.csv>mylist.txt ); done;
Mac OS Big Sur with zsh
The ISO8601-style dates really simplify situations like this. Try this glob pattern:
for f in ./2021-0[1-5]*; do
(cd "$f"; printf "file '%s'\n" *.csv > mylist.txt)
done