bash remove files older than code example
Example 1: delete old files linux
find /opt/backup -type f -mtime +30 -exec rm -f {} \;
Example 2: delete logs older than 7 days linux
find /media/bkfolder/ -mtime +7 -name'*.gz' -exec rm {} \;
find /opt/backup -type f -mtime +30 -exec rm -f {} \;
find /media/bkfolder/ -mtime +7 -name'*.gz' -exec rm {} \;