linux delete files older than code example
Example 1: delete old files linux
find /opt/backup -type f -mtime +30 -exec rm -f {} \;
Example 2: linux delete files older than specific date
find /path ! -newermt "YYYY-MM-DD HH:MM:SS" | xargs rm -rf
find /opt/backup -type f -mtime +30 -exec rm -f {} \;
find /path ! -newermt "YYYY-MM-DD HH:MM:SS" | xargs rm -rf