A simple script that backs up a directory to another directory, and removes old backups when over a specified limit.
Find a file
2026-06-15 12:47:01 +02:00
.gitignore Add backup scrupt. Add .env config 2026-05-03 01:20:34 +02:00
LICENSE.md Add README.md. Add setup to README.md. Add MIT license to LICENSE.md 2026-05-03 01:40:25 +02:00
main.py Now skip .DS_Store as for some reason python thinks its a directory. 2026-06-15 12:47:01 +02:00
README.md Add README.md. Add setup to README.md. Add MIT license to LICENSE.md 2026-05-03 01:40:25 +02:00
requirements.txt Add backup scrupt. Add .env config 2026-05-03 01:20:34 +02:00

Directory Backup Script

A simple script that backs up a directory to another directory, and removes old backups when over a specified limit.

This script is currently used to backup git.getagripgal.nl to several backup sites over samba.

Setup

# Setup a venv (Optional)
python -m venv .
source bin/activate

# Install the dependencies.
python -m pip install -p requirements.txt

# Run the script (After setting up the .env file.)
python main.py

Config

The config is stored in the .env file.

SOURCE_DIR= # The source directory to backup.
BACKUP_DIR= # The resulting directory the backups get copied to.
MAX_BACKUPS= # The maximum amount of backups stored at a time.