Script to backup changed files in a given folder.
Project description
trs-file-backup
trs-file-backup automatically watches your working directories and creates timestamped backups of every changed file — purely local, no cloud, no sync service, no complex setup. Ideal for developers and creators who want a simple safety net while working on files that are not (yet) in version control.
Requirements
- Python 3.10 or higher
- OS: Windows, Linux, macOS
Features
- 📁 Top-Level Monitoring (subdirectory support planned): Monitors files directly in the source directory
- 📦 Flat Backup Structure: All backups stored in one directory for easy access
- 🔄 Incremental Backups: Only backup files that have changed
- 🕐 Timestamped Files: Each backup uses format
filename_YYYY_MM_DD__HH_MM_SS.ext - 👁️ Watch Mode: Continuously monitor directories and backup automatically
- ⏱️ Configurable Debounce: Adjustable delay before backup (default: 2 seconds)
- 🎯 Smart Exclusions: Automatically skip hidden files
- 🚫 Custom Patterns: Exclude specific files with wildcard patterns
- 📊 State Tracking: Maintain backup history in
.backup_state.json(stored in backup directory) - 📝 Activity Logging: All operations logged to
backup.logwith timestamps - 🔍 Dry-Run Mode: Preview changes before backing up
Quick Start
Installation
Install this via pip (or your favorite package manager):
pip install trs-file-backup
Basic Usage
# Initialize backup tracking
trs-file-backup init --source ./myproject --destination ./backup
# One-time backup of modified files
trs-file-backup run --source ./myproject --destination ./backup
# Continuous monitoring (watch mode)
trs-file-backup watch --source ./myproject --destination ./backup
# Exclude specific patterns
trs-file-backup run --source ./myproject --destination ./backup --exclude "*.log" --exclude "temp_*"
# Custom debounce delay (wait 5 seconds before backup)
trs-file-backup run --source ./myproject --destination ./backup --debounce 5
# Preview without copying
trs-file-backup run --source ./myproject --destination ./backup --dry-run
# Get help
trs-file-backup --help
trs-file-backup run --help
Example Output
Original file: report.txt
Backup file: report_2026_01_13__14_30_22.txt
Commands
init: Initialize backup tracking for a directoryrun: Execute a one-time backup of modified fileswatch: Continuously monitor and backup files in real-time
Use trs-file-backup COMMAND --help for detailed information on each command.
Contributing
Contributions are welcome! See CONTRIBUTING.md for setup instructions, commit conventions, and the release process.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file trs_file_backup-2.0.1.tar.gz.
File metadata
- Download URL: trs_file_backup-2.0.1.tar.gz
- Upload date:
- Size: 180.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd21d39d07c861f235276a11bc8f515522e5631e302beee1be5b1051be6238ae
|
|
| MD5 |
c09101b2dcb7a57c780c9f239537ddfe
|
|
| BLAKE2b-256 |
33581d8feabab16ed2fb6ee3037cf10a6784c26a8bbd96406d5f33c1cc732ebe
|
Provenance
The following attestation bundles were made for trs_file_backup-2.0.1.tar.gz:
Publisher:
ci.yml on TheRedSwabian/trs-file-backup
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
trs_file_backup-2.0.1.tar.gz -
Subject digest:
fd21d39d07c861f235276a11bc8f515522e5631e302beee1be5b1051be6238ae - Sigstore transparency entry: 1790234933
- Sigstore integration time:
-
Permalink:
TheRedSwabian/trs-file-backup@399de9ef36f6955f5ee2b890b3ebf400acf27916 -
Branch / Tag:
refs/heads/develop - Owner: https://github.com/TheRedSwabian
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@399de9ef36f6955f5ee2b890b3ebf400acf27916 -
Trigger Event:
push
-
Statement type:
File details
Details for the file trs_file_backup-2.0.1-py3-none-any.whl.
File metadata
- Download URL: trs_file_backup-2.0.1-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6cf661fc37e1047c2029c998c4a8a150f5b3c40ed2dec224adbb365b21cda70a
|
|
| MD5 |
7aae4f2a0132321ed84ed19d50ce5351
|
|
| BLAKE2b-256 |
d2d9c35a53f0756fb43d556722d13c7b4ed42f4cdaa078780c0685d1322c9fbc
|
Provenance
The following attestation bundles were made for trs_file_backup-2.0.1-py3-none-any.whl:
Publisher:
ci.yml on TheRedSwabian/trs-file-backup
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
trs_file_backup-2.0.1-py3-none-any.whl -
Subject digest:
6cf661fc37e1047c2029c998c4a8a150f5b3c40ed2dec224adbb365b21cda70a - Sigstore transparency entry: 1790234971
- Sigstore integration time:
-
Permalink:
TheRedSwabian/trs-file-backup@399de9ef36f6955f5ee2b890b3ebf400acf27916 -
Branch / Tag:
refs/heads/develop - Owner: https://github.com/TheRedSwabian
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@399de9ef36f6955f5ee2b890b3ebf400acf27916 -
Trigger Event:
push
-
Statement type: