Skip to content

Commit 81c4347

Browse files
committed
make download_data executable
1 parent 6b5575c commit 81c4347

1 file changed

Lines changed: 25 additions & 3 deletions

File tree

download_data.sh

100644100755
Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1-
# Download a data file stored on S3 and store it in the work/data folder
2-
# This folder might not be the best choice, depending on your project
3-
mc cp s3/donnees-insee/diffusion/ETAT_CIVIL/2020/DECES_COM_1019.csv ~/work/data/
1+
#!/bin/bash
2+
3+
# === Description ===
4+
# This script downloads a data file from an S3 bucket using `mc` (MinIO client)
5+
# and stores it in the ~/work/data directory.
6+
7+
# === Config ===
8+
BUCKET_PATH="s3/donnees-insee/diffusion/ETAT_CIVIL/2020/DECES_COM_1019.csv"
9+
DEST_DIR="$HOME/work/data"
10+
DEST_FILE="$DEST_DIR/$(basename "$BUCKET_PATH")"
11+
12+
# === Ensure destination folder exists ===
13+
mkdir -p "$DEST_DIR"
14+
15+
# === Download the file ===
16+
echo "Downloading $BUCKET_PATH to $DEST_FILE..."
17+
mc cp "$BUCKET_PATH" "$DEST_DIR"
18+
19+
# === Check success ===
20+
if [ $? -eq 0 ]; then
21+
echo "✅ File downloaded successfully to $DEST_FILE"
22+
else
23+
echo "❌ Failed to download file from $BUCKET_PATH"
24+
exit 1
25+
fi

0 commit comments

Comments
 (0)