Deleting all attached files

Hello, I am having trouble deleting all the files attached to a Thing.

My goal: When I delete a thing, I want all of the uploaded files attached to it to also be deleted.
The only way I can do this right now is by doing a workflow where I use a number of actions of “Delete Uploaded File” and specify each URL. This solution doesn’t work as I don’t know in advance how many files my users will upload.

I essentially need to do a “for loop” to cycle through each uploaded file and delete it by its URL, and then delete the Thing itself. How would I go about doing this?

Seems like it should be something obvious, but I can’t figure it out. Without this, storage may snowball overtime.

Thanks,
David

backend recurring workflow

1 Like

@boston85719 but how would I specify to do this for every uploaded file?

I’m familiar with setting up backend workflows, and can schedule them to reoccur or whatever. But not sure how that enables me to iterate over the list and delete each one.

Thanks,

Same way…just make it a recurring event that triggers until the number of files is 0.