File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments