-
Notifications
You must be signed in to change notification settings - Fork 0
/
get-inputs.sh
executable file
·40 lines (37 loc) · 1.15 KB
/
get-inputs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env bash
rm -r tmp/file-share
wget -P tmp https://irma.nps.gov/DataStore/DownloadFile/663063
unzip tmp/663063 -d tmp/file-share
rm tmp/663063
# # Find all input files in the project root and move them to test/ directory
# find * \
# \( -name "00-input" -o -name ".00-input" -o -name "spsurvey-input-data.csv" \) \
# -not -path "tmp/*" -not -path "output/*" \
# -exec bash -c '\
# for d; do
# mkdir -p "test/$(dirname $d)"
# mv "$d" "test/$(dirname $d)"
# done' _ {} +
# rm -r test
# Move all input files into their respective example directories
# find tmp \
# \( -name "00-input" -o \
# -name ".00-input" -o \
# -name "spsurvey-input-data.csv" \) \
find tmp \
\( -name "00-input" -o \
-name ".00-input" -o \
-name "*_spsurvey.csv" -o \
-name "*_InputforHT.csv" \) \
-exec bash -c '\
for d; do
echo $d
# The following is likely only temporary.
if [[ $d == *_spsurvey.csv || $d == *_InputforHT.csv ]]; then
d_new=$(dirname $d)/spsurvey-input-data.csv
mv $d $d_new
d=$d_new
fi
cp -r $d $(grep -o "example.*" <<< $d)
done' _ {} +
rm -r tmp/file-share