Reputation: 817
script to calculate directory size and delete the oldest log inside if crosses the threshold usage? There is a log rotation inside this folder and it the size crosses the threshold limit say 10GB I want to delete the some oldest file . Help me with the script. I know how to delete the files older than x days but I want to set threshold limit and delete some old log.
Upvotes: 0
Views: 182
Reputation: 70391
du
tells you disk usage. For finding files older than x days, use find
with -ctime
or -mtime
. The -delete
option to find
deletes the found files directly.
(Yes I know this isn't a complete answer. Neither is this a complete question.)
Upvotes: 1