[nylug-talk] logrotate question

C Thala cthala at gmail.com
Sat Feb 2 17:07:28 EST 2008


On Feb 2, 2008 5:00 PM, Kristian Erik Hermansen wrote:
> > I would like to keep the last N files. Let's say 5.
>
> Delete all files created more than 5 days ago?
> $ find /path/to/logs -ctime +5 -type f -exec rm -f {} \;

I know how to use find/xargs to delete files by timestamp.

What I want to do is to delete anything over the last N files.


More information about the nylug-talk mailing list