[English] [prepnú» na slovenčinu]
matej.sustr.sk / code / backup-rotate


The backup-rotate bash script deletes oldest of files having the same prefix (or being in the same directory), while keeping files which are below a simple threshold:

  • age in days (since last modification),
  • number of files,
  • or both.

The current version of backup-rotate uses find to locate the files to consider for deletion, so it does not suffer from the limitation of maximum parameters as with shell expansion.

If you are looking for a more sophisticated solution for less files, but including various retention schedules, try fileprune, written in C, by Diomidis Spinellis.


See the man page for usage. There is also a HTML-formatted man backup-rotate(1) available.


backup-rotate is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.


NameLast modifiedSizeDescription
[TGZ]backup-rotate-1.6.tar.gz12-Aug-2008 00:0416K
[TGZ]backup-rotate-1.7.tar.gz17-Sep-2009 20:4816K
[TGZ]backup-rotate-1.8.tar.gz13-Jan-2011 21:1016K