Windows backup CLI tool based on Robocopy
- Backup a batch of sources by one tool
- Delete backups older than N days
- Send email about work
- Save compressed log
- Change settings in
email.json:
$EmailTo = 'example@example.com'
$EmailFrom = 'example@example.com'
$EmailPassword = '$eCr3tP@$sW0Rd'
$EmailSmtpServer = 'smtp.example.com'
$EmailSmtpPort = 587
- Uncomment this line to use TLS not SSL for e-mail
[System.Net.ServicePointManager]::SecurityProtocol = "Tls, TLS11, TLS12"
- Turn ON e-mail notifications
$SendEmail = $true
- Turn ON log saving
$SaveLog = $true
$LogDir = "D:\Backup\logs"
In array $Backups insert line(s) for backup
, @('Name', 'Source', 'Destination', 'DTL', 'Parameters')
| Option | Explanation | Example | Default value |
|---|---|---|---|
| Name | Backup name | My code | |
| Source | Backup from | C:\code | |
| Destination | Backup to | D:\Backup | |
| DTL | Days to live[1] | 10 | 0 |
| Parameters | Robocopy parameters | Read Robocopy syntax | $DefaultParameters |
Note: disable backups by # at the begin of line or <# ... #> for multiline.
[1] - 'Days to live' means that new backup will be in Destination\NAME_YYMMDD_HHMMSS. After it all folders and files older than DTL days will be deleted in Destination. If DTL is "0" backup will be in Destination with default or special parameters.
