Task:
Need to remove old log files that do not have a good naming pattern to wildcard. Would like to remove all but the last 90 days of them.
Solution:
1. Navigate to folder:
$ cd /var/log/app/
2. Perform the delete:
$ sudo find . -maxdepth 1 -type f -mtime +91 -delete
Note:
-maxdepth 1 = this folder only
-mtime +91 = older than 91 days = selection to delete
-delete = the action - to delete the files
previous page
|