Created
August 2, 2023 10:18
-
-
Save RagedUnicorn/81a332d9e01d7c51a74a24ecae95abfa to your computer and use it in GitHub Desktop.
Cleanup AWS S3 Bucket
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
$Bucket = "ragedunicorn-ai" | |
$Prefix = "work/gressil_reimagined/" | |
$Objects = aws s3api list-object-versions --bucket $Bucket --prefix $Prefix | ConvertFrom-Json | |
ForEach ($Object in $Objects.Versions) { | |
Write-Output "Deleting object: $($Object.Key), version: $($Object.VersionId)" | |
aws s3api delete-object --bucket $Bucket --key $Object.Key --version-id $Object.VersionId | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment