Compare commits
2 Commits
958effcad1
...
2b385a945d
Author | SHA1 | Date | |
---|---|---|---|
|
2b385a945d | ||
|
a9ca4b0985 |
@ -1,2 +1,3 @@
|
|||||||
# scripts-n-stuff
|
# scripts-n-stuff
|
||||||
|
|
||||||
|
Collection of useful powershell and bash scripts
|
@ -33,6 +33,8 @@ $pathToFolder = switch ($targetEnv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Write-Host "Starting to zip notes folder... Target folder will be: $pathToFolder"
|
||||||
|
|
||||||
$7zipPath = "$env:ProgramFiles\7-Zip\7z.exe"
|
$7zipPath = "$env:ProgramFiles\7-Zip\7z.exe"
|
||||||
|
|
||||||
if (-not (Test-Path -Path $7zipPath -PathType Leaf)) {
|
if (-not (Test-Path -Path $7zipPath -PathType Leaf)) {
|
||||||
@ -46,9 +48,15 @@ $Source = "C:\Users\dechert\Notizen"
|
|||||||
$currentDate = get-date -f MM-dd-yyyy_HH_mm_ss
|
$currentDate = get-date -f MM-dd-yyyy_HH_mm_ss
|
||||||
$targetFilename = "Notizen_Backup_" + $currentDate + ".zip"
|
$targetFilename = "Notizen_Backup_" + $currentDate + ".zip"
|
||||||
|
|
||||||
$Target = $pathToFolder + $targetFilename
|
$zipTarget = $targetFilename
|
||||||
|
|
||||||
# mx=9 is maximum compression level
|
# mx=9 is maximum compression level
|
||||||
7zip a -mx=9 $Target $Source
|
7zip a -mx=9 $zipTarget $Source
|
||||||
|
|
||||||
# TODO: use Robocopy to move files to network
|
# use Robocopy to move files to target folder
|
||||||
|
# robocopy . "\\Swaghausen-WG\homes\marcelo\ATB\Notizen-Backups\" "Notizen_Backup_12-15-2021_15_25_40.zip" /Z /r:60 /w:5 /MIR /MT:64 /NFL
|
||||||
|
# TODO print progress: https://stackoverflow.com/questions/13883404/custom-robocopy-progress-bar-in-powershell
|
||||||
|
robocopy . $pathToFolder $zipTarget /Z /r:60 /w:5 /MIR /MT:64 /NFL
|
||||||
|
|
||||||
|
# delete zip file in local folder if successfull
|
||||||
|
Remove-Item $zipTarget
|
||||||
|
Loading…
x
Reference in New Issue
Block a user