Automatically delete uploaded files after 24h from system

Hi guys, please help me to understand how to automatically delete uploaded files after 24h?
what is the best way?

i am thinking to store all uploads links to the database,

after that run a backend workflow to
→ run only when “created data” its past + 20h
->in this workflow use DELETE UPLOAD FILE , on it Do a Search DB and grab the same URL with uploaded file that has “created data” more than 20h
after that delete a thing from DB

i am on right way?
i don’t know how to do ONLY WHEN: Search on DB that Create Data are more than 20h?

Thanks you
Best Regards

For this part, you’ll need to do Current Date Time – Create Date :format as hours > 20

Here’s a similar condition from my app…
Screen Shot 2022-12-02 at 5.16.25 PM

make sure you enable api workflows in your settings api tab.

Then create a recurring backend workflow that deletes every 24 hours.

Can’t you just schedule a workflow to delete the file 24 hours after it was uploaded?

Hi @Buddha thanks you for your answer,

i am tried but i can’t figure out how you make formatted as “hours” when i chose creation data it only formatted as data

please take a look for screenshot

Best Regards

Hello @doug.burden

thanks you for you answer,

yes i have enabled the API workflow on API Tab,
please can you explain how i can create a recurring backend workflow every 24h?

Best Regards

Hello @adamhholmes

Yes its what i need, please could you explain better how to archive this ?

Best Regards

Create a backend workflow (with a parameter of type 'file), with a single action to delete an uploaded file:

image

Then, on your app page, whenever a file is uploaded (i.e. when the fileuploader input’s value is changed) just schedule that workflow to run in 24 hours time, and pass the uploaded file into it:

1 Like

The easiest way would be set up a database trigger with scheduled API workflow to delete file in 24 hours starting from the creation of a thing in DB

Awesome flow @adamhholmes , thanks you for your effort,

it will be a problem if there its 300-400 files a day? all scheduled to the backend after 24h?
it will store all this information on the backend when will be scheduled?

Best Regards

No it won’t be a problem at all… (unless you try to delete them all at the same time)

Hello, @sat_miha thanks you for your reply,

it will look like the scheduled API backend workflow only when last item on DB creation data its more than 24?
on the backend workflow delete the upload file do a search DB for lines that create data its more than 24 hours? is where i am stacked,

or how it will look? please can you explain

Best Regards

@adamhholmes understand will try to do it,

thanks you for your effort!!

Best Regards

Once datatype thing will be created, database trigger will start working. For every thing.
Like if
first thing was created at 18.10
second thing was created at 19.10
it mean first file will be deleted next day in 18.10 and other in 19.10 respectively

1 Like

About how to find a file that was created 24 hours ago
Creation date >current date time + hours - 24

This topic was automatically closed after 70 days. New replies are no longer allowed.