How to delete files recursively from an S3 bucket

后端 未结 12 615
不知归路
不知归路 2021-01-29 23:54

I have the following folder structure in S3. Is there a way to recursively remove all files under a certain folder (say foo/bar1 or foo or foo/bar2/1 ..)

         


        
12条回答
  •  误落风尘
    2021-01-30 00:31

    I just removed all files from my bucket by using PowerShell:

    Get-S3Object -BucketName YOUR_BUCKET | % { Remove-S3Object -BucketName YOUR_BUCKET -Key $_.Key -Force:$true }
    

提交回复
热议问题