Last active
December 19, 2019 14:50
-
-
Save rosshadden/d377fec34b02bfcb308d92a3a575ad65 to your computer and use it in GitHub Desktop.
aws-toucher
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
#!/usr/bin/env bash | |
main() { | |
local profile="$1" | |
local bucket="$2" | |
shift; shift | |
local files=( "$@" ) | |
if [ ! "$files" ]; then | |
files="$(aws --profile "$profile" s3 ls --human-readable "s3://$bucket" | fzf -m --preview= | awk '{ print $5 }')" | |
fi | |
if [ ! "$files" ]; then exit; fi | |
for file in "${files[@]}"; do | |
echo "$file" | |
aws --profile "$profile" s3 cp "s3://$bucket/$file" "s3://$bucket/$file" | |
echo | |
done | |
} | |
main "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment