I'm performing 2 loops in my code. Below is the pseudo code.
get the subfolder list in the bucket
Loop through every subfolders
loop through every objects in a subfolder
read the objects
delete the objects (So at the end the subfolder will be empty)
get the subfolder list again (asuming the empty subfolder also will be deleted and new subfolders can be created by someone)
But as the result i'm getting an infinite loop since the subfolders are still there in the bucket. So i was finding a solution to delete the subfolder after the deletion of every objects in it. But I couldn't find a solution for this. Please suggest your idea
Below is the s3 folder structure
├── bucket
└── folder-1
└── folder-2
└── folder-3