0

I am wondering if there is a way (script/extension) to delete files from a folder after a certain file has reached the age of 30 days. For example, I have a folder which receives uploaded files daily. I want the files that have been there for 30 days to be deleted.

1
  • 1
    Yes, of course this can be done. However, you have posted a "requirements dump" in a community where support is free, but often the people who provide this support are actually paid, professional Joomla developers/administrators. It is a sign of respect to these people, to include (in your question) the research that you've already conducted, extensions in the JED that you have seen/tried, and any attempts you've made to add a script to a scheduled cronjob. Please edit your question so that it does look like you are asking for paid professionals to hand over a solution that they normally
    – mickmackusa
    Dec 18, 2021 at 21:15

1 Answer 1

1

If your Joomla website is hosted on a Linux or Unix server, then you could create a cron job (a scheduled process) to run the following command every night:

find /path/to/files* -mtime +30 -exec rm {} \;

It will find and remove ("rm") all files in the folder that you specify and that have a modified time ("mtime") that is older than 30 days.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.