ONTAP Discussions

Empty Folder on Delete with ONTAP S3 multiprotocol

BHAGBV3001251129
544 Views

I have bucket named xyz, inside which there are following objects

a/b/obj1.doc

a/b/obj2.doc

a/b/c/obj3.doc

a/b/c/obj4.doc

On deleting all the above 4 objects, folders a, b and c are not deleted and they are empty

Why are the folders not deleted when there are no objects?

 

9 REPLIES 9

ChLokesh
462 Views

Hello there,

 

- Is deleting the bucke the ultimate objective here?
- What error do we see when the folder is being deleted?

- I understand, you must have followed the below document for deleting the objects.

https://docs.netapp.com/us-en/storagegrid/tenant/deleting-s3-bucket-objects.html 

BHAGBV3001251129
438 Views

I don't want to delete the bucket. Objective is to delete the objects are its folders if its empty. 

Objects are getting deleted without error but folders are not.

ChLokesh
435 Views

Again, 
What error do you see when you delete the folders?

As mentioned above there are no errors when deleting the objects

chamfer
337 Views

@BHAGBV3001251129 

 

Does this bucket have versioning enabled?

BHAGBV3001251129
317 Views

No, versioning is not enabled

ChLokesh
269 Views

Hello,

• In S3, what appears as folders in the AWS Management Console are actually prefixes in the object key names.
• Since folders are not actual entities but part of the object keys, deleting all objects within a prefix does not result in the deletion of the prefix itself.
• The prefix will simply not be displayed in the console once all objects under it are deleted.
• To ensure that folders (prefixes) disappear from the S3 console when there are no objects:
1. Delete All Objects:
     Ensure that all objects within the prefix are deleted, including any placeholder objects.
2. Use AWS CLI or SDK:
     You can use the AWS CLI or SDK to delete all objects within a prefix, including any empty placeholder objects.

• Example: Deleting All Objects in a Prefix Using AWS CLI:
1. List Objects: First, list all objects within the prefix to ensure you know what will be deleted.
aws s3 ls s3://your-bucket/folder1/ --recursive


2. Delete Objects: Use the aws s3 rm command to delete all objects within the prefix.

aws s3 rm s3://your-bucket/folder1/ --recursive

We are using S3 multiprotocol with ONTAP. With this option we have folders, right? How does folders get deleted in this option?

What are placeholder objects?
Here is our configuration for the bucket

BHAGBV3001251129_0-1738819216782.png

 

@ChLokesh Any update on this?

Public