linux delete files older than 30 days 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 {} \;
Example 3: linux delete files older than specific date
find /path ! -newermt "YYYY-MM-DD HH:MM:SS" | xargs rm -rf