#backup #backup-utility #incremental #multi-threaded #tool #compression #config-toml

app backupsync

A fast and efficient multi-threaded backup tool written in Rust, supporting compression, incremental backup, and automation

1 unstable release

new 0.1.0 Feb 6, 2025

#192 in Filesystem

Download history 122/week @ 2025-02-03

122 downloads per month

MIT license

14KB
172 lines

BackupSync 🛡️📂

A fast, efficient, and cross-platform backup & synchronization tool written in Rust!


✨ Features

✅ Backup & Sync — Supports incremental backup, only copying files if they are newer.

✅ Multi-threading — Uses multiple threads for faster file copying.

✅ Compression Support — Backup as .tar.gz (default) or .zip (optional).

✅ Progress Bar — See live progress with indicatif.

✅ Logging — Saves backup history in backup_log.txt.

✅ Config File Support — Define paths in config.toml for automation.

✅ Cross-Platform — Works on Windows, Linux, macOS.

✅ CLI Friendly — Run via terminal:


backupsync ~/Documents ~/Backup 

✅ Automation Support — Schedule backups with crontab (Linux/macOS) or Task Scheduler (Windows).


💡 Why Use BackupSync?

Unlike high-level backup software, BackupSync is:

✅ Lightweight — No unnecessary UI, just raw speed.

✅ Optimized for Performance — Uses multi-threading and recursive traversal for fast backups.

✅ Cross-Platform — Works on Windows, Linux, macOS without dependencies.

✅ Open Source — Modify, extend, and contribute!


🚀 Installation

  1. Download the latest backupsync binary from Releases. Move it to a system-wide location:
sudo mv backupsync /usr/local/bin/
  1. Now, you can run backupsync from anywhere!

📌 Method 2: Build from Source (Requires Rust)

  1. Install Rust:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

  1. Clone the repository:
git clone https://github.com/YOUR_GITHUB/backupsync.git  
cd backupsync  
cargo build --release

  1. Move the compiled binary to /usr/local/bin/ (Linux/macOS).

📌 Method 3: For Windows

  1. Install Rust (if not installed):
  • Download and install Rust for Windows.
  • Restart your terminal after installation.

  1. Clone the repository: Open PowerShell and run:
git clone https://github.com/lakshyajn/BackupSync.git
cd BackupSync
  1. Build the project:
cargo build --release
  1. Move the binary to system PATH (Optional, for global usage):
$env:Path += ";$PWD\target\release"

🛠️ Usage

🔹 Basic Backup (CLI)

Run the following command (For Linux,macOS):

backupsync <source_folder> <backup_folder>

📌 Example:

backupsync ~/Documents ~/Backup
This will incrementally copy all files from ~/Documents to ~/Backup.

Run the following command (For Windows):

  • Once installed, you can run it from the terminal.
backupsync C:\Users\YourUsername\Documents C:\Users\YourUsername\Backup

  • If you didn't moved it to your parent working directory (For all OSs):
cd backupsync
./target/release/backupsync C:\Users\YourUsername\Documents C:\Users\YourUsername\Backup

🔹 Enable Compression

  • To create a .tar.gz backup instead of raw files:
backupsync ~/Documents ~/Backup tar.gz
  • To create a .zip backup:
backupsync  ~/Documents ~/Backup zip

🔹 Using a Config File (config.toml)

  • Instead of typing paths every time, create a config.toml file:
source = "/home/user/Documents"
backup = "/home/user/Backup"
  • Then, just run:
backupsync
  • It will read paths from config.toml automatically.

📜 Backup Log (backup_log.txt)

All backup operations are logged in backup_log.txt, including copied files and errors.

[2025-02-06 12:34:56] Copied /home/user/Documents/file1.txt -> /home/user/Backup/file1.txt
[2025-02-06 12:34:58] Copied /home/user/Documents/file2.jpg -> /home/user/Backup/file2.jpg

🤖 Automating Backups

🔹 Linux/macOS (crontab)

  • Open crontab:
crontab -e
  • Add this line to schedule a daily backup at 2 AM:
0 2 * * * /usr/local/bin/backupsync ~/Documents ~/Backup

🔹 Windows (Task Scheduler)

  1. Open Task Scheduler (Win + R, type taskschd.msc, press Enter).
  2. Click Create Basic Task → Name it "BackupSync".
  3. Set Trigger → Choose Daily or your preferred schedule.
  4. Set Action → Select Start a program.
  5. Browse for the backupsync.exe file in your target/release/ folder.
  6. Add arguments:
"C:\Users\YourName\Documents" "D:\Backup"

📦 Using BackupSync as a Rust Crate

If you want to integrate backupsync into your Rust project, add it to your Cargo.toml:

[dependencies]
backupsync = "0.1.0"
Example Rust Code:
rust
Copy
use backupsync::backup;

fn main() {
    backup("/home/user/Documents", "/home/user/Backup").unwrap();
}


🛠️ Contributing

Want to improve BackupSync? Feel free to:

Open an issue for feature requests. Submit a pull request with improvements.

Happy Backing Up! 🎉

Dependencies

~11–21MB
~307K SLoC