-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVerify-Backup.ps1
More file actions
35 lines (27 loc) · 843 Bytes
/
Copy pathVerify-Backup.ps1
File metadata and controls
35 lines (27 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
$SourcePath = "D:\"
$BackupPath = "F:\Backup 2019-03-08\"
Write-Progress -Activity "Getting File List" -PercentComplete 0
$FileList = DIR $SourcePath -Recurse -File
$Total = $FileList.Count
$Count = 0
$BadCount = 0
$FileList | % {
$File = $_.FullName
$Backup = $File.Replace($SourcePath, $BackupPath)
Try {
$Match = (Get-FileHash $File).Hash -eq (Get-FileHash $Backup).Hash
}
Catch {
$Match = $false
}
If (-not $Match) {
$BadCount++
"Hash mismatch: $File, $Backup"
}
$Count++
If ($Count % 1000 -eq 0) {
Write-Progress -Activity "File $Count of $Total" -PercentComplete ($Count/$Total*100)
}
}
Write-Progress -Activity "Checking Files" -Completed
"There were $BadCount bad files out of the $Count files checked"