Deleting files or folders in Linux ubuntu / centos OS can be done utilizing cron facilities and bash scripts.
input the command to open the cron page:
crontab -e
file contents as follows:
0 0 * * * find /destination-folder-to/ -type d -name '*' -mtime +5 -exec rm -rv {} +
0 0 * * * :
This means that this command will be run every day at 00:00 in the morning. More details can learn cron on the website https://crontab.guru/
/destination-folder-to/ :
Specify which folders you want to automatically delete for a certain duration of time.
+5 :
This means that files and folders that are 5 days old will be deleted.