---
title: "rsync-backup-rotator, automated backup rotation for rsync"
language: en
topics: ["cloud", "cyber-security", "data", "linux", "server", "work"]
full_article_url: https://willem.com/en/2023-12-15_backup-rotation-scheme/
---
# rsync-backup-rotator, automated backup rotation for rsync

*A dependency-free bash script that rotates backups by weekday and month.*

> I wrote rsync-backup-rotator, a free GPLv3 bash script that rotates an up-to-date 'current' backup folder into weekday and monthly subfolders, giving you multiple recovery points instead of one overwritable copy.

The script assumes you already keep an up-to-date copy of your files in a folder named current, for example with rsync -arvz SOURCE TARGET. From there it rotates that data into a week folder with a subfolder per weekday, and on the first day of each month into a monthly subfolder like January or February.
Install by downloading the script from source.willem.com/rsync-backup-rotator and making it executable with chmod +x rsync-backup-rotator.sh. Run ./rsync-backup-rotator.sh /path/to/parent with -w for weekday backups, -m for monthly backups and --delete to also remove files in the destination that no longer exist in the source.
It is a plain bash script without dependencies, runs on GNU/Linux, BSD and macOS (and probably under WSL on Windows), and is free software under the GPLv3 license.
