How can I delete files on firebase Storage with Laravel 8?

Viewed 218

I am using Firebase.
I set up two directories on Storage, images, and temp.
I will upload photos in temp and after 30 days
I want to set up a crontab to delete the images in temp.
Example:

temp/. upload date
inside folder file got 3 files

1.jpg 2021/10/9<br>
2.jpg 2021/10/10<br>
3.jpg 2021/10/20<br>

I will run a crontab every day to delete the images which live more than 30 days.
In today's cron, I'll delete 1.jpg and 2.jpg.
but I couldn't find a way to delete many photos.

I know how to delete 1 file with name.

$storage = app('firebase.storage');
$storage->getBucket()->object('temp/123.jpg')->delete();

but how can I only know the directory name (temp), and get all files inside and delete specific files?

1 Answers

according to similar answers on Stackoverflow there is no way to do it. I also searched in Firebase documentation but haven't found any methods. You have to delete each file manually. Read this.

Related