Created
September 4, 2019 18:31
-
-
Save yuriploc/d0de76518d4324cceef087ea0295211b to your computer and use it in GitHub Desktop.
Download bucket files and save them in folders
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
len=${#buckets[@]} | |
i=0 | |
while [ $len -gt $i ] | |
do | |
bucket=${buckets[$i]} | |
url=${urls[$i]} | |
echo $bucket | |
mkdir -p $bucket && cd $bucket | |
filenames=$(aws s3 ls s3://${buckets[$i]} | awk '{ print $4 }') | |
j=0 | |
for fls in $filenames | |
do | |
(`wget -qc ${url}${fls} -O ${fls}`) & | |
j=$(( j+1 )) | |
if (( $j%10 == 0 )) | |
then | |
wait ${!} | |
fi | |
done | |
echo "WAITING....." | |
wait ${!} | |
cd .. | |
i=$(( i+1 )) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment