Skip to content

Instantly share code, notes, and snippets.

@rosshadden
Last active December 19, 2019 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rosshadden/d377fec34b02bfcb308d92a3a575ad65 to your computer and use it in GitHub Desktop.
Save rosshadden/d377fec34b02bfcb308d92a3a575ad65 to your computer and use it in GitHub Desktop.
aws-toucher
#!/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