Automated file clean / deletion script or tagging?

Hi peeps,

I’m looking into a way to automate file cleaning/deletion. I know this will probably work with the (automated) Tag Manager but I was wondering if anyone has made something like this before and what is the best way to go.

I want to create several folders where I can store files to be deleted after ‘x’ years. This means files uploaded in folder ‘y’ gets the tag ‘x’ so it will be deleted after ‘x’ years. Since I don’t have to store files older than ‘x’ years, they will automatically be deleted.

However, has someone perhaps made or know a script/solution where we can trigger this deletion manually? So let’s say I have had Nextcloud up and running for 2 years and ‘x’ is 1 year. Since my server is getting stuffed and full, I want to execute a script which scans the files and deletes the files older in a specific folder (of choice). Even cooler would be if I would have I can make choose the time options like like files older than, 1 year, 2 years or 2 months in ‘selected destination’. Anyone know a solution like this?

And if we look at resources needed to scan the files, would a script be a bigger server load than the tag manager?

It would be great to hear your expertise here and what would be the wisest to do.

I’m still struggling on how to tag a file in a specific folder to be deleted after ‘x’ year in ‘Workflow’ and the MIME tags like ‘httpd/unix-directory’
Anyone know where I can find a better description on the MIME types?