File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 5
5
6
6
# set -eo pipefail
7
7
8
+ # Vars.
9
+ # Date of first monday 8 weeks in the past. Taste to suit!
10
+ start_day=$( date --date ' monday-56 days' +" %Y%m%d" )
11
+ today=$( date +" %Y%m%d" )
12
+
8
13
# Purge the receiving directory.
9
14
echo " Purging ./receiving..."
10
15
rm -f ./receiving/*
@@ -14,7 +19,11 @@ echo "Running the indicator..."
14
19
env/bin/python -m delphi_safegraph_patterns
15
20
16
21
# Copy the files to the ingestion directory.
22
+ # The unwieldy one-liner does the following:
23
+ # - Pipe a list of files into awk.
24
+ # - awk prints the files that are inclusive of ${start_day} to ${today}.
25
+ # - Pipe that list into xargs and copy those files to the receiving dir.
17
26
echo " Copying files to the ingestion directory..."
18
- # Hack to make cp care less about missing recent files since we don't always have them.
19
- cp $( date + " receiving/%Y%m* " ) /common/covidcast/receiving/safegraph 2> /dev/null
20
- cp $( date --date= ' -1 month ' + " receiving/%Y%m* " ) /common/covidcast/receiving/safegraph
27
+ cd ./receiving || exit
28
+ ls -1 * .csv | awk ' $0>=from && $0<=to ' from= " ${start_day} " to= " ${today} " \
29
+ | xargs cp -t /common/covidcast/receiving/safegraph
You can’t perform that action at this time.
0 commit comments