Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/duplicati/duplicati.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax <michal@naiman.eu>2018-02-02 23:30:52 +0300
committerGitHub <noreply@github.com>2018-02-02 23:30:52 +0300
commit89ae43042980131805c7d582355ef5523be42910 (patch)
tree7a85d9b7ef9029ee493ea464432c30c54b3efe20 /Tools/Verification
parent26d1c52c02663229a4559bf6d333478e03c3141e (diff)
fixes
Diffstat (limited to 'Tools/Verification')
-rw-r--r--Tools/Verification/DuplicatiVerify.ps117
1 files changed, 8 insertions, 9 deletions
diff --git a/Tools/Verification/DuplicatiVerify.ps1 b/Tools/Verification/DuplicatiVerify.ps1
index 8b33d125c..3df5fd93d 100644
--- a/Tools/Verification/DuplicatiVerify.ps1
+++ b/Tools/Verification/DuplicatiVerify.ps1
@@ -58,12 +58,11 @@ function Verify-Hashes
(
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
- [string]$filename
+ [System.IO.FileInfo]$filename
)
[int]$errorCount = 0
[int]$checked = 0
- [string]$folder = Split-Path -Path $filename
$remoteVolumes = $((Get-Content $filename) -Join "`n" | ConvertFrom-Json) | Sort-Object Name
$statsState = @{}
@@ -73,7 +72,7 @@ function Verify-Hashes
foreach ($remoteVolume in $remoteVolumes) {
[string]$volFileName = $remoteVolume.Name
- [string]$volFilePath = Join-Path -Path $folder -ChildPath $volFileName
+ [string]$volFilePath = Join-Path -Path $filename.DirectoryName -ChildPath $volFileName
if(-not $(Test-Path $volFilePath)) {
if($remoteVolume.State -eq $([RemoteVolumeState]::Deleted -as [int])) {
@@ -104,8 +103,8 @@ function Verify-Hashes
}
}
- [string]$prefix = $(Split-Path -Path $filename -Leaf) -replace "-verification.json", ""
- [array]$filesInStorage = Get-ChildItem $folder -Include "$prefix*" -Exclude $(Split-Path -Path $filename -Leaf) | `
+ [string]$prefix = $filename.Name -replace "-verification.json", ""
+ [array]$filesInStorage = Get-ChildItem $(Join-Path $filename.DirectoryName "$prefix*") -Exclude $filename.Name -File | `
Select-Object -ExpandProperty Name | Sort-Object
[array]$filesInVerification = $remoteVolumes | Select-Object -ExpandProperty Name | Sort-Object
@@ -146,7 +145,7 @@ if(Test-Path $FileOrDir -PathType Leaf) {
exit $(Verify-Hashes -filename $FileOrDir)
}
-$verFiles = @(Get-ChildItem $FileOrDir -Filter "*-verification.json")
+$verFiles = @(Get-ChildItem $FileOrDir -Filter "*-verification.json" -File)
if ($verFiles.Count -eq 0) {
Write-Host "No verification files in folder: $FileOrDir"
@@ -155,9 +154,9 @@ if ($verFiles.Count -eq 0) {
[int]$errorCount = 0
-$verFiles | % {
- Write-Host "Verifying file: $($_.Name)"
- $errorCount += $(Verify-Hashes -filename $_.FullName)
+foreach ($verFile in $verFiles) {
+ Write-Host "Verifying file: $($verFile.Name)"
+ $errorCount += $(Verify-Hashes -filename $verFile.FullName)
}
exit $errorCount \ No newline at end of file