upload-index 612 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env bash
  2. if (( $# != 1 )); then
  3. printf 'Usage: %s path/to/public_html\n' "$(basename "$0")"
  4. exit 1
  5. fi
  6. DIR="$1"
  7. if [ ! -d "$DIR" ]; then
  8. printf '%s is not a directory!' "$DIR"
  9. exit 1
  10. fi
  11. # Standardize format for $DIR
  12. DIR=$( cd "$DIR" && pwd )
  13. eval "$("$HOME"/.amazonrc)"
  14. s3cmd put --recursive "${DIR}/" "s3://photos.tylercipriani.com/"
  15. for file in "${DIR}"/*; do
  16. fn=$(basename "$file")
  17. s3cmd setacl --acl-public --recursive "s3://photos.tylercipriani.com/${fn}"
  18. done
  19. s3cmd modify --add-header='Content-type:text/css' --recursive "s3://photos.tylercipriani.com/main.css"