Created
December 4, 2021 18:25
-
-
Save elijahcruz12/7bcbaa1b8ad01fdd0ea45ee563086178 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
path=$1 # the path of the directory where the files and directories that need to be copied are located | |
s3Dir=$2 # the s3 bucket path that must exist. | |
for entry in "$path"/*; do | |
name=`echo $entry | sed 's/.*\///'` # getting the name of the file or directory | |
if [[ -d $entry ]]; then # if it is a directory | |
aws s3 cp --endpoint=<digitaloceanendpoint> --recursive "$name" "$s3Dir/$name/" | |
else # if it is a file | |
aws s3 cp "$name" "$s3Dir/" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment