Im looking at deleting not used and soft deleted files.
For example we have some records (module invoices) where the pdf attached to the record can be regenarated many times, each generation is pushing a new pdf onto the system and links the fileid to the record. so after 3 regeneration of invoices there are 2 not used pdf in the system but there isnt a trace at the database for these files.
also i would love to delete all soft-deleted records and files after a certain period of time. are there some scripts which i could use, or do you have a starting point for writing a script for that?
ive found the sql snippets which give me a good start for deleting soft deleted records in db.
If im not mistaken i would have to loop through every file on filesystem data dir and do a db query if i can find that fileid anywhere in the db, if not i can safly delete the files and preview files on filesystem. is this correct, or is there a faster way around?