File size: 680 Bytes
b40e563
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
27
28
29
30
31
32
33
34
#!/bin/bash

<<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