- Newest
- Most votes
- Most comments
Adding to Indranil's answer, the S3 console fakes folders for our pleasure (and confusion at times). If there's an object whose name ends in "/" then the S3 console will display it as a folder but to the underlying S3 service it's just another object. Similarly if you create a folder (e.g. "folder1") from within the S3 console then it will create a 0-size object with a "/" suffix on its name, e.g. "folder1/".
So to answer your question "isn't there any way", yes sort of. You can follow the same idiom as the S3 console and keep 0-sized objects named "folder1/", "folder2/" etc that will appear as folders in the console even when all other objects with those prefixes have been deleted. They will however appear as objects when you query the S3 API. Then add a filter to your Lifecycle rule, ticking "Specify minimum object size" and only delete objects > 0 bytes. I expect your 0-sized objects will remain.
S3 is an object store and not a file system. So it doesn't have the notion of folders. Instead it uses what are known as prefixes, which may make it appear like you are using folders, but prefixes are just part of the key. If there isn't any object that is using a particular prefix, then that prefix has no valid reason to exist. If you need the prefix, it can be recreated the moment you create a new object that uses the prefix.
So, there isn't any where my folders are not impacted by lifecycle policy ?
Yes, if you use "Specify minimum object size" as in my answer a few days ago - did that not help?
Relevant content
- Accepted Answerasked a year ago
- Accepted Answerasked a year ago
- asked 6 months ago
- asked 8 days ago
- AWS OFFICIALUpdated 6 days ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 5 months ago
Thanks, it worked.