Skip to content

Instantly share code, notes, and snippets.

@sahir
Last active March 19, 2019 10:16
Show Gist options
  • Save sahir/fbc7832a286eddd151f68b68b50e1879 to your computer and use it in GitHub Desktop.
Save sahir/fbc7832a286eddd151f68b68b50e1879 to your computer and use it in GitHub Desktop.
Transferring files between remote server to S3
#!/bin/sh
if [ $1 == "help" ];
then
echo "First argument: Path of file on Remote host. \nSecond argument: Path of directory on Local host.\nThird argument: OS type.
Forth argument: configure aws boolean values true/false.\nFifth argument: S3Uri."
else
scp -rv $6:$1 $2
if [ $3 == "mac" ]; then
brew install awscli
else
apt-get install -y awscli
fi
if [ $4 ]; then
aws configure
fi
aws s3 cp $2 s3://$5 --recursive
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment