Created
June 7, 2016 12:34
-
-
Save seventhskye/e3d37c498a89f8a25577c01a65d5053d to your computer and use it in GitHub Desktop.
Script to upload or download a current working directory to an s3 bucket. Script assumes that the present working directory will be the name of the s3 directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -eq 0 ]; then | |
echo "Usage: $@ upload|download" | |
if [ "$BUCKET_NAME" == "" ]; then | |
echo "variable \$BUCKET_NAME name must be set." | |
fi | |
else | |
DIR=`basename ${PWD}` | |
aws configure --profile cloud-backup | |
if [ "$1" == "upload" ]; then | |
aws s3 sync . s3://$BUCKET_NAME/$DIR | |
fi | |
if [ "$1" == "download" ]; then | |
aws s3 sync s3://$BUCKET_NAME/$DIR . | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment