A robust, automated file backup solution designed for Windows environments (with backward compatibility for Windows 7). It securely transfers files to a remote SFTP server, tracks versions using a local SQLite database, implements a "Smart GFS" (Grandfather-Father-Son) retention policy, and provides built-in Web UI, Email, and Nextcloud reporting.
C:, D:, etc.) while explicitly ignoring network drives and CD-ROMs.tracker.db) to remember exactly what has been uploaded, the exact file hash (SHA-256), and the original path (including special characters).Report_2024-05-15_14-30-22.docx).C_drive, D_drive).VCRUNTIME140.dll) to run.C:\Program Files\atrc\backup. You should create this folder manually or let the program create it on first run.atrc_windows_backup_to_sftp_with_tracking.exe and select "Run as Administrator". This is required to read protected files (like those in C:\Users) and to write to the Program Files directory.config.txt: On the first run, the program will generate a default config.txt in C:\Program Files\atrc\backup\. Open this file with Notepad and fill in your credentials.config.txt# atrc backup configuration (CRLF format)
sftp_host=192.168.1.4
sftp_port=22
sftp_user=test
sftp_password=your_sftp_password_here
web_bind=0.0.0.0:8080
# Nextcloud Upload URL for Status Updates
# Provide the public share link (File Drop) or WebDAV URL here
nextcloud_status_upload_url=https://your-nextcloud-domain/index.php/s/YOUR_SHARE_TOKEN
# Email Reports
smtp_host=mail.atrc.net.pk
smtp_port=587
smtp_user=backup_mailer
smtp_password=your_email_password_here
email_from=backup_mailer@atrc.net.pk
email_to=admin@atrc.net.pk
# Add specific folders to back up in addition to auto-scanning all local drives:
# extra_source=C:\MySpecialProject
The program runs in a loop (backup by default) but accepts flags to change its behavior. Open Command Prompt as Administrator to use these.
atrc_windows_backup_to_sftp_with_tracking.exe
What it does: Scans all local drives, compares files against the database, uploads changed files, prunes old versions, emails a report, uploads a status report to Nextcloud, and then exits.
Cooldown: By default, it will refuse to run if it was executed less than 1 hour ago (it emails and uploads a "Skipped" notification). It also ignores files modified in the last 6 hours to prevent backing up files currently being written to.
--update-now)atrc_windows_backup_to_sftp_with_tracking.exe --update-now
What it does: Ignores the 1-hour run limit and the 6-hour file cooldown. It forces an immediate backup of any file that has changed.
--keep-alive)atrc_windows_backup_to_sftp_with_tracking.exe --keep-alive
What it does: Runs the backup and then keeps the program running so you can access the Web Dashboard (default: http://localhost:8080). Press Ctrl+C to stop.
--restore)atrc_windows_backup_to_sftp_with_tracking.exe --restore "D:\MyRestoreFolder"
What it does:
tracker_*.db database.D:\MyRestoreFolder\C_drive\Users\Public\...D:\MyRestoreFolder\D_drive\Projects\...--help)atrc_windows_backup_to_sftp_with_tracking.exe --help
GetDriveTypeW to find local drives. It intentionally skips C:\Windows, C:\Program Files, C:\ProgramData, pagefile.sys, hiberfil.sys, .iso, and .vmdk files. Files currently locked by the OS or without read permissions are skipped and logged.C:\Program Files\atrc\backup\databases\.
file_tracking: The primary table. Stores the original path, file hash, and last upload time.file_versions: Stores the history of uploaded versions. Used by the Smart GFS pruning algorithm.events: A log of everything the program does (uploads, errors, skips).PUT (with Basic Auth) or browser-like POST multipart endpoints, automatically falling back through several known Nextcloud API paths until one succeeds.lettre Rust library. Because some internal mail servers have expired or mismatched SSL certificates, the program is hardcoded to use Port 587 (STARTTLS) but bypasses certificate validation errors to ensure delivery.C:\ drive, it is heavily recommended to run it as Administrator. If not, it will skip directories it cannot read and log an [ACCESS DENIED] warning.Problem: Program immediately exits and says "Backup skipped."
Solution: It ran less than 1 hour ago. Use --update-now to force it.
Problem: "Database format changed. Please restart the program."
Solution: The program detected an older database schema. It has automatically deleted the old database. Simply run the program again.
Problem: Email fails to send.
Solution: Verify your SMTP credentials in config.txt. If the mail server has a broken SSL certificate, the program's built-in bypass should handle it, but the username/password must be exactly correct (e.g., backup_mailer@atrc.net.pk vs backup_mailer).
Problem: Nextcloud status upload fails.
Solution: Verify the nextcloud_status_upload_url in config.txt. If using a public share, ensure the share has "Allow uploading" (File Drop) enabled in the Nextcloud web interface. The program automatically tries multiple WebDAV and API endpoints, but the share must permit anonymous or token-based uploads.
Problem: "Access Denied" errors in the console.
Solution: Close the program, right-click the .exe, and select "Run as Administrator".