Skip to main content

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.

maintained license PyPI Python ruff uv Build Status codecov

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.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 (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 directory
  • run: Execute a one-time backup of modified files
  • watch: 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

trs_file_backup-2.0.1.tar.gz (180.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

trs_file_backup-2.0.1-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

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

Hashes for trs_file_backup-2.0.1.tar.gz
Algorithm Hash digest
SHA256 fd21d39d07c861f235276a11bc8f515522e5631e302beee1be5b1051be6238ae
MD5 c09101b2dcb7a57c780c9f239537ddfe
BLAKE2b-256 33581d8feabab16ed2fb6ee3037cf10a6784c26a8bbd96406d5f33c1cc732ebe

See more details on using hashes here.

Provenance

The following attestation bundles were made for trs_file_backup-2.0.1.tar.gz:

Publisher: ci.yml on TheRedSwabian/trs-file-backup

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for trs_file_backup-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6cf661fc37e1047c2029c998c4a8a150f5b3c40ed2dec224adbb365b21cda70a
MD5 7aae4f2a0132321ed84ed19d50ce5351
BLAKE2b-256 d2d9c35a53f0756fb43d556722d13c7b4ed42f4cdaa078780c0685d1322c9fbc

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page