-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfetch.sh
26 lines (20 loc) · 853 Bytes
/
fetch.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
#!/bin/bash
IFS=$'\n';
mkdir -p "raw/xlsx/domestic"
mkdir -p "raw/xlsx/international"
for url in $(cat "urls.txt");
do
filename=$(echo $url | rev | cut -d '/' -f 1 | rev)
encoded_filename=$(echo $filename | sed 's/ /%20/g')
if [[ "$url" == *"domestic"* ]]; then
if ! [ -f "raw/xlsx/domestic/${filename}" ]; then
curl "https://public-prd-dgca.s3.ap-south-1.amazonaws.com/InventoryList/dataReports/aviationDataStatistics/airTransport/domestic/monthly/${encoded_filename}" > "raw/xlsx/domestic/${filename}"
sleep 5
fi
else
if ! [ -f "raw/xlsx/international/${filename}" ]; then
curl "https://public-prd-dgca.s3.ap-south-1.amazonaws.com/InventoryList/dataReports/aviationDataStatistics/airTransport/international/quaterly/${encoded_filename}" > "raw/xlsx/international/${filename}"
sleep 5
fi
fi
done