aboutsummaryrefslogtreecommitdiff
path: root/fetch-inputs
blob: 5161496d47fb1cf87ee05a710b052d56952ad06f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh

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