#!/bin/bash < 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 " 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