Expand description
§Simple utility to rotate backup files
Typical use:
find . -iname "*.tar" | rotate_backup rotate --output delete | xargs rm -f§Providing the files
You can either provide files as argument or via stdin:
ls *.tar | rotate_backup rotate --output delete | xargs rm -f(requiresstdfeature)rotate_backup --output delete $(ls *.tar) | xargs rm -f
§Selecting output
By default, only file to keep are shown (equivalent to --output keep).
Otherwise, you can use --output delete
§Date format
By default, the tool looks for this format: YYYY-mm-dd, but you can select a different format:
rotate_backup --format "%Y%m%d"
This will parse 20240213 for instance.
§Choosing how much logs are kept
The tool uses an exponential function based on days since the oldest backup.
This is inspired from frotate
You can choose the base for the exponent: rotate_backup --base 1.2.
Note that only base > 1.0 are accepted.
§Debug the partitions
You can use the debug command to find out how partitions are split:
rotate_backup debug --base 1.3 20
Showing 20 partitions with exponential base 1.3
Ranges represents the file age in days since oldest backup
Only 1 file is kept per partition
------------------------------------------------
No | Start..End
000| 00000..00001
001| 00001..00003
002| 00003..00005
003| 00005..00008
004| 00008..00011
005| 00011..00015
006| 00015..00020
007| 00020..00027
008| 00027..00036
009| 00036..00047
010| 00047..00061
011| 00061..00079
012| 00079..00103
013| 00103..00134
014| 00134..00174
015| 00174..00226
016| 00226..00293
017| 00293..00380
018| 00380..00493
019| 00493..00640