Hi
I am new to Linux / scripting language. I need to improve our Linux servers at work and looking to claim some space my deleting log files/ folders on a 5 day basis.
Can someone help me with creating a script to do so.
Any sample script will be helpful.
Regards
Welcome to forums, if you need automation then you can use crontab to do this
0 0 */5 * * rm /path/to/log/directory/*.log
This is link might be useful to start
Below code will delete all the files of type *.log
in the directory /log/dir
which are older than 5 days
find /log/dir -type f -name "*.log" -mtime +5 | xargs rm -f