Console Documentation
Archive Console
Archive Console is a command-line version of Archive designed for automation, scripting, and power users who prefer terminal-based tools.
Key features:
- No GUI dependencies - runs on server installations
- Perfect for scripts and automation
- Same sync engine as the GUI version
- Detailed output for logging and monitoring
Installing Console Version
The console version is portable and requires no installation or dependencies.
- Download
Archive.Console.zipfrom the releases page - Extract to your preferred location (e.g.,
C:\Tools\Archive) - Add the folder to your system PATH for easy access
Console Usage
Archive Console uses a command-based interface:
Archive.Console.exe <command> [options]
Available Commands
sync
Synchronize files from source to destination.
Archive.Console.exe sync --source <path> --destination <path> [options]
Options
--source,-s: Source directory path (required)--destination,-d: Destination directory path (required)--recursive,-r: Include subdirectories (default: true)--delete-orphaned: Delete files in destination that don't exist in source--verify: Verify files after copying--dry-run: Preview operations without making changes--exclude: Exclude pattern (can be used multiple times)
Console Examples
Basic Sync
Sync documents to external drive:
Archive.Console.exe sync --source "C:\Users\John\Documents" --destination "E:\Backup\Documents"
Dry Run Preview
Preview what would be copied without making changes:
Archive.Console.exe sync --source "C:\Projects" --destination "D:\Backup\Projects" --dry-run
Mirror Sync with Deletion
Create an exact mirror (including deletions):
Archive.Console.exe sync ^
--source "C:\Photos" ^
--destination "E:\Backup\Photos" ^
--delete-orphaned ^
--verify
With Exclusions
Exclude specific folders and files:
Archive.Console.exe sync ^
--source "E:\" ^
--destination "F:\" ^
--exclude "$RECYCLE.BIN" ^
--exclude "System Volume Information" ^
--exclude "*.tmp"
Exit Codes
0- Success1- Error occurred2- Cancelled by user
Architecture
Archive is built with a modular architecture:
- Archive.Core - Core sync engine and business logic
- Archive.GUI - WPF desktop application
- Archive.Console - Command-line interface
Both GUI and Console applications use the same Archive.Core library, ensuring consistent behavior.
Technology Stack
- .NET 9 with C# 12
- WPF for GUI
- SQLite for database (GUI only)
- JSON configuration (Console only)
Database Schema
The GUI version uses SQLite to store configuration and history. The database is located at:
%APPDATA%\Archive\archive.db
Tables
- Jobs - Backup job configurations
- JobHistory - Execution history with statistics
- JobLogs - Detailed file operation logs
- Settings - Application settings
The database can be accessed directly with SQLite tools for reporting or analysis.
Sync Algorithm
Archive uses a smart synchronization algorithm that:
- Compares file modification times and sizes
- Identifies files that need to be copied or updated
- Detects orphaned files (if deletion is enabled)
- Processes files in optimal order
- Optionally verifies copied files with hash comparison
File Comparison
A file is considered different if:
- The destination file doesn't exist
- File sizes differ
- Source file modification time is newer than destination
Performance
Archive is optimized for:
- Fast enumeration of large directory structures
- Minimal I/O operations
- Efficient memory usage
- Cancellable operations
Scripting with Archive Console
Archive Console is perfect for automation scripts. Here's a PowerShell example:
# Backup script with error handling
$source = "C:\Important\Data"
$destination = "E:\Backups\Data"
# Run backup
& "C:\Tools\Archive\Archive.Console.exe" sync `
--source $source `
--destination $destination `
--verify `
--delete-orphaned
# Check exit code
if ($LASTEXITCODE -eq 0) {
Write-Host "Backup completed successfully" -ForegroundColor Green
# Log success
Add-Content -Path "C:\Logs\backup.log" -Value "$(Get-Date): Success"
} else {
Write-Host "Backup failed with code $LASTEXITCODE" -ForegroundColor Red
# Send alert
Send-MailMessage -To "admin@company.com" -Subject "Backup Failed" -Body "Check logs"
}
Windows Task Scheduler
You can use Windows Task Scheduler to run Archive Console automatically:
- Open Task Scheduler
- Create a new Basic Task
- Set your desired trigger (daily, weekly, etc.)
- Action: Start a program
- Program:
C:\Tools\Archive\Archive.Console.exe - Arguments:
sync --source "C:\Data" --destination "E:\Backup"
Contributing
Archive is open source! Contributions are welcome.
- Report bugs on GitHub Issues
- Submit pull requests with improvements
- Suggest features and enhancements