{
 "id": 69739,
 "slug": "rsync-backup-rotator-automated-backup-rotation-for-rsync",
 "url": "https://agents.willem.com/en/snippets/rsync-backup-rotator-automated-backup-rotation-for-rsync/",
 "language": "en",
 "title": "rsync-backup-rotator, automated backup rotation for rsync",
 "subtitle": "A dependency-free bash script that rotates backups by weekday and month.",
 "summary": "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.",
 "topics": [
  "cloud",
  "cyber-security",
  "data",
  "linux",
  "server",
  "work"
 ],
 "date": "2023-12-15",
 "published": "2023-12-15T00:00:00+01:00",
 "created": "2026-08-30T07:13:19.161000+02:00",
 "updated": "2026-08-30T07:16:45.312000+02:00",
 "full_article_url": "https://willem.com/en/2023-12-15_backup-rotation-scheme/",
 "author": {
  "name": "Willem L. Middelkoop",
  "url": "https://willem.com"
 },
 "note": "A short distillation of a longer willem.com post. Not currently published on willem.com itself.",
 "answers_question": "How do you rotate rsync backups on Linux?",
 "text": "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.\nInstall 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.\nIt 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.",
 "markdown_url": "https://agents.willem.com/en/snippets/rsync-backup-rotator-automated-backup-rotation-for-rsync/snippet.md"
}