Marcus Rohden
Marcus Rohden

Reputation: 113

Delete media from cloud storage after X hours

I have 2 categories of media on my Firebase Storage Bucket located in separated folders. I would like firebase deleting the media of a single folder after 24h since the upload date. Does anyone have any suggestions on how to do that? Thanks

Upvotes: 0

Views: 444

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 599726

There is nothing built into Firebase/Cloud Storage for this, so you will have to build it yourself.

Since the metadata for each object contains a timeCreated property, you can get a list of files, then check the metadata of each file, and delete the file if it expired.

If you get stuck while implementing this recipe, post a new question with the minimum code that reprocues where you got stuck.

Upvotes: 1

Related Questions