TeeTee
TeeTee

Reputation: 147

Setting lifecycle rule on a folder in a google cloud bucket

I have a google cloud bucket called "life_meaning" I want to set a lifecycle rule on a folder named "42" in the root of the bucket. I want the objects in the bucket to be deleted after 42 days. I set a prefix on object conditions in the rule of life_meaning/42/

I feel that this is incorrect should it be 42/ or 42?

Google docs are a little ambiguous with how this works: https://cloud.google.com/storage/docs/lifecycle#matchesprefix-suffix

Upvotes: 1

Views: 794

Answers (1)

Sathi Aiswarya
Sathi Aiswarya

Reputation: 2940

The delimiter “/” argument can be used to restrict the results to only the "files" in the given "folder". Without the delimiter, the entire tree under the prefix is returned.

If you want to delete the objects within the “42” folder., you should set the prefix as "42/".

If you set the prefix to "42" (without the trailing slash) It won't target the items in the "42" folder directly, and it will apply the lifecycle rule to objects in in other folders that start with "42" in their name

Upvotes: 1

Related Questions