Archive log files based on date
system
ID: 20150720
ACCESSING DATA...
SYSTEM: ARCHIVE
FILE: ARCHIVE LOG FILES BASED ON DATE
STATUS: ACTIVE
Here’s some piece of code to use on a cron job when you have a software component (database or application) that spits out logs and you want to archive or delete those files based on creation date.
#Archive
find log/ -type f -mtime +681 -ls -exec mv {} log/2011/. \;
#Delete
find . -type f -mtime +30 -ls -exec rm {} \;