Skip to main content

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.

maintained license PyPI Python ruff uv Build Status codecov

Requirements

  • Python 3.13.17 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 a backup in watch mode (default: 2 seconds); run copies at once
  • 🎯 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)
  • 🛠️ Settings Menu: Show and edit the saved exclusion patterns and debounce delay with config
  • 📝 Activity Logging: All operations logged to backup.log with 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 (watch waits 5 seconds after the last change before the backup)
trs-file-backup watch --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

Saved Settings

init saves the exclusion patterns and the debounce delay in .backup_state.json. A later run or watch without --exclude or --debounce uses the saved value. Giving the option replaces the saved value; it is not added to the saved patterns. Patterns are matched against the file name only; a pattern that can never match one, such as logs/*.log, is rejected (the full rule is AC-4.9 in the feature specification). The new value is saved, also when run finds no modified files; only run --dry-run never writes the state file. Without a state file, the defaults apply: no patterns of your own and a debounce delay of 2 seconds. The state file belongs to the folder given with --destination: a copied or moved backup folder works on its own state file and never writes into the old folder. A backup folder belongs to one source: run and watch with another --source stop with an error; use another backup folder, or run init again.

To see or change the saved settings without running init again, use config:

# Print the saved settings
trs-file-backup config show --destination ./backup

# Open a menu to change the debounce delay or add, remove and clear exclusion patterns
trs-file-backup config --destination ./backup

Nothing is written until you choose "save" in the menu. The changes take effect at the next start of run or watch. Stop a running watch and wait for a running run to finish first: both write their own settings back to the state file and would overwrite your changes.

Example Output

Original file: report.txt Backup file: report_2026_01_13__14_30_22.txt

Commands

  • init: Initialize backup tracking for a directory
  • run: Execute a one-time backup of modified files
  • watch: Continuously monitor and backup files in real-time
  • config: Show and edit the saved settings (config show only prints them)

Use trs-file-backup COMMAND --help for detailed information on each command.

Known Limitations

  • Two backups of the same file within one second get the same name, and the newer backup replaces the older one. This is known and accepted for now; see KL-1 in the specification.

Contributing

Contributions are welcome! See CONTRIBUTING.md for setup instructions, commit conventions, and the release process.

Metadata

Release files for trs-file-backup 4.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for trs-file-backup 4.0.0
File Size Uploaded Provenance Actions
trs_file_backup-4.0.0.tar.gz 156.1 kB With provenance Details for trs_file_backup-4.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for trs-file-backup 4.0.0
File Interpreter ABI Platform Actions
trs_file_backup-4.0.0-py3-none-any.whl Python 3 none any Details for trs_file_backup-4.0.0-py3-none-any.whl

Total release size: 177.0 kB

Release files / trs_file_backup-4.0.0.tar.gz

Download URL trs_file_backup-4.0.0.tar.gz
Size 156.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e7dd8bff323d464abebadb4ddb0825b663be02f9b85f7ef4bea98510475e8201
BLAKE2b-256 checksum
How to use checksums
1db8a07179828b34d155b5888f78538764fd4b8b999bdd62889b004bd551083d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / trs_file_backup-4.0.0-py3-none-any.whl

Download URL trs_file_backup-4.0.0-py3-none-any.whl
Size 20.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cb2a867c7feb9006c47ed3852f61e899b4036fdcf2637ca285385844e4f8d672
BLAKE2b-256 checksum
How to use checksums
d16b5f757857e782b04c498be1cabca8f548ce0a5fabb696d9b972e848b36ad9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Security for trs-file-backup 4.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for trs_file_backup-4.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page