Created
August 4, 2023 11:06
-
-
Save simonespa/44c37df4e18bdacefe8747e870eccf1d to your computer and use it in GitHub Desktop.
Download S3 versions
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
| aws s3api list-object-versions --bucket ${BUCKET} --prefix ${FILE} --max-items ${MAX_ITEM} --no-cli-pager > versions | |
| cat versions | jq -r '.Versions[].VersionId' > versionids | |
| cat versions | jq -r '.Versions[] | "\(.LastModified) \(.VersionId)"' > lastmodified_versionids | |
| aws s3api get-object --bucket ${BUCKET} --key ${FILE} --version-id ${VERSION_ID} | |
| let "index = 1" | |
| while read version | |
| do | |
| echo "${index}) downloading version ${version}" | |
| aws s3api get-object --no-cli-pager --bucket ${BUCKET} --key ${FILE} --version-id "${version}" ./catalogue-"${index}.json" | |
| let "index += 1" | |
| done < versionids |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment