Created
October 14, 2017 21:39
-
-
Save alatas/24a77edc401db6a4907fbc4b15b9f7be to your computer and use it in GitHub Desktop.
7Zip Full and Diff Backup Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Backup { | |
param( | |
[Parameter(Mandatory = $True)][string]$Inputs, | |
[Parameter(Mandatory = $True)][string]$FullBackup, | |
[string]$DiffBackup = $null, | |
[string]$7ZPath = "C:\Program Files\7-Zip\7z.exe", | |
[string]$UpdateSwitch = "-up0q0r2x2y2z0w2!" | |
) | |
if ($DiffBackup -eq $null) { | |
& $7ZPath a -mhe -ms=off -ssw -mx= -t7z $FullBackup $Inputs | |
} | |
else { | |
& $7ZPath u -mhe -ms=off -ssw "$FullBackup" "$Inputs" -mx=7 -t7z -u- $UpdateSwitch$DiffBackup | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment