Spaces:
Running
Running
| <<COMMENT | |
| Usage: | |
| bash sync_samples_to_s3.bash <BASE_DIR> | |
| Dependencies: | |
| - awscli (https://aws.amazon.com/cli/) | |
| Credentials to export as environment variables: | |
| - AWS_ACCESS_KEY_ID | |
| - AWS_SECRET_ACCESS_KEY | |
| COMMENT | |
| # Check if a valid directory is provided as an argument | |
| if [ -z "$1" ]; then | |
| echo "Usage: $0 <BASE_DIR>" | |
| exit 1 | |
| fi | |
| if [ ! -d "$1" ]; then | |
| echo "Error: $1 is not a valid directory" | |
| exit 1 | |
| fi | |
| BASE_DIR="$1" | |
| S3_BUCKET="s3://treeoflife-10m-sample-images" | |
| # Loop through all directories and sync them to S3 | |
| for dir in $BASE_DIR/*; do | |
| if [ -d "$dir" ]; then | |
| dir_name=$(basename "$dir") | |
| aws s3 sync "$dir" "$S3_BUCKET/$dir_name/" | |
| fi | |
| done |