Compare commits
No commits in common. "2b385a945d720fe3812dc2495daf8a813ca3d4e1" and "958effcad12ec794f44f77217c030cff14bd5cc0" have entirely different histories.
2b385a945d
...
958effcad1
@ -1,3 +1,2 @@
|
|||||||
# scripts-n-stuff
|
# scripts-n-stuff
|
||||||
|
|
||||||
Collection of useful powershell and bash scripts
|
|
@ -33,8 +33,6 @@ $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)) {
|
||||||
@ -48,15 +46,9 @@ $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"
|
||||||
|
|
||||||
$zipTarget = $targetFilename
|
$Target = $pathToFolder + $targetFilename
|
||||||
|
|
||||||
# mx=9 is maximum compression level
|
# mx=9 is maximum compression level
|
||||||
7zip a -mx=9 $zipTarget $Source
|
7zip a -mx=9 $Target $Source
|
||||||
|
|
||||||
# use Robocopy to move files to target folder
|
# TODO: use Robocopy to move files to network
|
||||||
# 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