Skip to content

Intelligent cross-platform backup system that automatically filters out development artifacts (node_modules, venv, __pycache__, .git). Incremental backups, auto-detects external drives, beautiful CLI. Pure Python, zero dependencies.

License

Notifications You must be signed in to change notification settings

CodingWithMK/smartbackup_file-backup-automation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”„ SmartBackup

Intelligent Backup System for Developers

Automatically backup your important files while skipping node_modules, virtual environments, and other build artifacts.

Python 3.9+ License: MIT CI Platform

Features β€’ Quick Start β€’ Installation β€’ Usage β€’ Configuration β€’ Contributing


πŸ€” Why SmartBackup?

Ever tried to backup your Documents folder only to wait hours because of massive node_modules folders or Python virtual environments?

SmartBackup solves this. It automatically detects and skips development artifacts, making your backups:

  • ⚑ 10x faster - Skip gigabytes of dependencies
  • πŸ’Ύ 10x smaller - Only backup what matters
  • 🧠 Smart - Incremental backups copy only changed files
  • πŸ”Œ Zero config - Works out of the box

✨ Features

Feature Description
πŸš€ Cross-Platform Works on Windows, macOS, and Linux
πŸ” Smart Filtering Auto-skips node_modules, venv, .git, __pycache__, etc.
πŸ“Š Incremental Backup Only copies new or modified files
πŸ“‹ Manifest Tracking JSON manifest for 10x faster incremental backups
πŸ”„ Restore Support Full restore functionality with pattern filtering
πŸ”Œ Auto-Detection Automatically finds external drives
πŸ“ Detailed Logging Progress bar + log file on backup drive
🎯 Zero Dependencies Pure Python, no pip installs required
βš™οΈ Configurable Add custom exclusions as needed

πŸš€ Quick Start

For Regular Users (No Installation)

Just download and run!

  1. Download the latest release or clone this repository
  2. Connect your external drive
  3. Run the backup:
python main.py

That's it! Your Documents folder will be backed up to the external drive.


πŸ“¦ Installation

Option 1: Direct Download (Easiest)

# Clone the repository
git clone https://github.com/CodingWithMK/smartbackup_file-backup-automation.git
cd smartbackup_file-backup-automation

# Run directly
python main.py

Option 2: Install with pip

# Clone and install
git clone https://github.com/CodingWithMK/smartbackup_file-backup-automation.git
cd smartbackup_file-backup-automation

pip install .

# Now you can run from anywhere
smartbackup

Option 3: Install with uv (Recommended for Developers)

git clone https://github.com/CodingWithMK/smartbackup_file-backup-automation.git
cd smartbackup_file-backup-automation

uv venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
uv pip install -e ".[dev]"

# Run
python main.py
# or
smartbackup

πŸ“– Usage

Basic Usage

# Backup Documents folder to auto-detected external drive
python main.py

# Or if installed
smartbackup

Common Options

# Backup a specific folder
python main.py --source ~/Projects

# Backup to a specific drive
python main.py --target /media/USB_DRIVE

# Find drive by name
python main.py --label "My Backup Drive"

# See what would be backed up (without copying)
python main.py --dry-run

# List available drives
python main.py --list-drives

# Quiet mode (less output)
python main.py --quiet

# Add extra folders to skip
python main.py --exclude "downloads" "*.iso"

All Options

usage: smartbackup [-h] [-s SOURCE] [-t TARGET] [-l LABEL] [--dry-run]
                   [-q] [--exclude PATTERN [PATTERN ...]] [--list-drives]
                   [--no-manifest] [--show-manifest] [--verify] [-v]
                   {restore} ...

Options:
  -h, --help            Show this help message
  -s, --source PATH     Source directory (default: Documents)
  -t, --target PATH     Target drive/directory
  -l, --label NAME      Find drive by label name
  --dry-run             Simulate without copying
  -q, --quiet           Minimal output
  --exclude PATTERN     Additional exclusion patterns
  --list-drives         Show available drives
  --no-manifest         Disable manifest tracking
  --show-manifest       Display manifest contents
  --verify              Verify backup against manifest
  -v, --version         Show version

Commands:
  restore               Restore files from backup

Restore Files from Backup

# Restore all files to original location
smartbackup restore --source /path/to/backup

# Restore to a specific directory
smartbackup restore --source /path/to/backup --target ~/Restored

# Restore only specific files (pattern matching)
smartbackup restore --source /path/to/backup --pattern "*.py" "*.md"

# Preview what would be restored (dry-run)
smartbackup restore --source /path/to/backup --dry-run

# List files in backup
smartbackup restore --source /path/to/backup --list

# Overwrite existing files
smartbackup restore --source /path/to/backup --overwrite

Manifest Commands

# Show manifest information
smartbackup --target /path/to/backup --show-manifest

# Verify backup integrity against manifest
smartbackup --target /path/to/backup --verify

# Disable manifest tracking (use traditional change detection)
smartbackup --no-manifest

πŸ“‹ Example Output

╔══════════════════════════════════════════════════════════════════════════════╗
β•‘                    Intelligent Backup System v0.2.1                          β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

β„Ή  [2024-01-15 09:30:22] Source directory: /Users/dev/Documents
β„Ή  [2024-01-15 09:30:22] Operating system: Darwin 23.1.0

β–Ά Searching for external storage medium...
βœ“  [2024-01-15 09:30:22] External medium found: BACKUP_USB (/Volumes/BACKUP_USB) - 234.5 GB free

β–Ά Scanning source directory: /Users/dev/Documents
β„Ή  [2024-01-15 09:30:45] Scan completed: 1,523 files found, 8,492 excluded

β–Ά Analyzing changes...
β„Ή  [2024-01-15 09:30:47] Analysis completed: 12 new, 34 modified, 0 to delete

β–Ά Starting backup operation...
βž• [COPIED] Projects/app/main.py (2.3 KB)
πŸ”„ [UPDATED] Documents/report.docx (156.2 KB)
[β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ] 100.0% (46/46) | 12.4MB/12.4MB

╔══════════════════════════════════════════════════════════════════════════════╗
β•‘                           BACKUP SUMMARY                                      β•‘
╠══════════════════════════════════════════════════════════════════════════════╣
β•‘  βœ“ Copied Files:              12                                              β•‘
β•‘  βœ“ Updated Files:             34                                              β•‘
β•‘  β—‹ Skipped Files:          1,477                                              β•‘
β•‘  βœ— Errors:                     0                                              β•‘
β•‘                                                                               β•‘
β•‘  Duration:               00:00:23                                             β•‘
β•‘  Speed:                  0.54 MB/s                                            β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

βœ“  Backup completed successfully!

🚫 What Gets Excluded

SmartBackup automatically skips these folders and files:

Click to see full exclusion list

JavaScript / Node.js

  • node_modules
  • .npm, .yarn
  • dist, build
  • .next, .nuxt

Python

  • venv, .venv, env
  • __pycache__
  • .pytest_cache, .mypy_cache
  • *.pyc, *.pyo

Version Control

  • .git
  • .svn
  • .hg

IDEs & Editors

  • .idea (JetBrains)
  • .vscode
  • *.swp, *.swo (Vim)

Build Artifacts

  • target (Java/Rust)
  • bin, obj (.NET)
  • .gradle

Operating System

  • .DS_Store (macOS)
  • Thumbs.db (Windows)
  • desktop.ini

Temporary Files

  • *.tmp, *.temp
  • *.log
  • *.bak
  • cache, .cache

βš™οΈ Configuration

Add Custom Exclusions

Command line:

python main.py --exclude "my_folder" "*.iso" "downloads"

Permanent exclusions are saved in:

  • Windows: %APPDATA%\SmartBackup\config.json
  • macOS/Linux: ~/.config/smartbackup/config.json

Backup Location

Files are backed up to:

YOUR_EXTERNAL_DRIVE/
└── Documents-Backup/
    β”œβ”€β”€ _backup_logs/
    β”‚   └── backup_20240115_093022.log
    β”œβ”€β”€ Your files and folders...
    └── ...

πŸ›‘οΈ No External Drive?

If no external drive is found, SmartBackup offers options:

╔════════════════════════════════════════════════════════════════╗
β•‘  ⚠  EXTERNAL STORAGE MEDIUM NOT FOUND                         β•‘
╠════════════════════════════════════════════════════════════════╣
β•‘  Please make sure that:                                        β•‘
β•‘  β€’ The external medium is connected                            β•‘
β•‘  β€’ The medium is recognized by the system                      β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

Options:
  [1] Create local temporary backup
  [2] Wait and try again
  [3] Cancel

πŸ§ͺ For Developers

Setup Development Environment

# Clone
git clone https://github.com/CodingWithMK/smartbackup_file-backup-automation.git
cd smartbackup_file-backup-automation

# Create virtual environment
python -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate

# Install with dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run linter
ruff check .

Project Structure

smartbackup_file-backup-automation/
β”œβ”€β”€ src/
β”‚   └── smartbackup/
β”‚       β”œβ”€β”€ __init__.py       # Package exports
β”‚       β”œβ”€β”€ __main__.py       # python -m smartbackup
β”‚       β”œβ”€β”€ backup.py         # SmartBackup main class
β”‚       β”œβ”€β”€ cli.py            # CLI argument parsing
β”‚       β”œβ”€β”€ config.py         # Configuration management
β”‚       β”œβ”€β”€ handlers.py       # Fallback handlers
β”‚       β”œβ”€β”€ models.py         # Data classes
β”‚       β”œβ”€β”€ core/
β”‚       β”‚   β”œβ”€β”€ engine.py     # Backup engine
β”‚       β”‚   β”œβ”€β”€ scanner.py    # File scanner
β”‚       β”‚   β”œβ”€β”€ detector.py   # Change detection
β”‚       β”‚   └── restore.py    # Restore engine
β”‚       β”œβ”€β”€ manifest/
β”‚       β”‚   β”œβ”€β”€ base.py       # Manifest classes
β”‚       β”‚   └── json_manifest.py  # JSON implementation
β”‚       β”œβ”€β”€ platform/
β”‚       β”‚   β”œβ”€β”€ resolver.py   # Path resolution
β”‚       β”‚   β”œβ”€β”€ devices.py    # Device detection
β”‚       β”‚   └── scheduler.py  # OS scheduler helpers
β”‚       └── ui/
β”‚           β”œβ”€β”€ colors.py     # Terminal colors
β”‚           └── logger.py     # Logging
β”œβ”€β”€ tests/                    # 175 tests
β”œβ”€β”€ main.py                   # Quick entry point
β”œβ”€β”€ pyproject.toml
└── README.md

Run from Source

# These all work:
python main.py
python -m smartbackup
smartbackup  # if installed

🀝 Contributing

Contributions are welcome! Here's how:

  1. Fork the repository
  2. Create a branch: git checkout -b feature/amazing-feature
  3. Make your changes
  4. Run tests: pytest
  5. Commit: git commit -m 'Add amazing feature'
  6. Push: git push origin feature/amazing-feature
  7. Open a Pull Request

See CONTRIBUTING.md for details.


πŸ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ™ Acknowledgments

  • Built with ❀️ for developers who are tired of backing up node_modules
  • Inspired by the frustration of slow backups

If this tool saved you time, consider giving it a ⭐

Report Bug β€’ Request Feature

```

About

Intelligent cross-platform backup system that automatically filters out development artifacts (node_modules, venv, __pycache__, .git). Incremental backups, auto-detects external drives, beautiful CLI. Pure Python, zero dependencies.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages