Created
August 3, 2018 04:30
-
-
Save nguyentienlong/7b0c899fcd664e5dc78268436dc8ec8f to your computer and use it in GitHub Desktop.
aws cli - copy and flatten nested s3 files structure
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
aws s3 ls source-bucket-name - recursive | grep -E "\w+\.+" | awk -F" " '{for(i=4; i<=NF; i++){printf "s3://%s", $i}; printf "\n"}' | head -n5 | xargs -I$ aws s3 cp $ s3://destination-bucket-name/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment