Skip to content

Instantly share code, notes, and snippets.

@yuriploc
Created September 4, 2019 18:31
Show Gist options
  • Save yuriploc/d0de76518d4324cceef087ea0295211b to your computer and use it in GitHub Desktop.
Save yuriploc/d0de76518d4324cceef087ea0295211b to your computer and use it in GitHub Desktop.
Download bucket files and save them in folders
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