Reputation: 1012
I am uploading few images on s3 server and storing the link in local DB using my android app. Now, if i am deleting a particular image link from local DB, i also want to remove the same image from s3 server.
Is it possible to delete image from s3 server using android app?
If yes, please tell me how to achieve this?
Upvotes: 0
Views: 1041
Reputation: 1857
This snippet of code works for me. folderPath is something like "topDir/secondDir/"
void deleteObjectsInFolder(String bucketName, String folderPath) {
for (S3ObjectSummary file : s3.listObjects(bucketName, folderPath).getObjectSummaries()){
s3.deleteObject(bucketName, file.getKey());
}
}
Upvotes: 1