blob: 4c3b00e25809fddb0c0da3ba6807455f67ac2264 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#!/bin/sh
cd "$(dirname "$0")"
find . \
-regextype egrep \
-mindepth 2 \
-maxdepth 2 \
-type d \
-regex '\./[0-9]{4}/[0-9]{2}' \
| while IFS=/ read _ y d
do
file=$y/$d/input
[ -f "$file" ] && continue
>&2 printf 'Fetching %s/%s... ' $y $d
wget -q --load-cookies=.cookies -O "$file" \
"https://adventofcode.com/$y/day/${d#0}/input"
>&2 printf 'DONE\n' >&2
done
|