Oh I have a server backing up data to a NAS, then I do replication from the source NAS to the destination NAS.
I'm looking for a way to verify that the number of sizes that have been sent to the destination NAS match those on the source NAS.
because the amount of moving data is very large, it is not possible to see one by one.
Does anyone have any suggestions and solutions regarding my problem?
Thank You
I think your best option if you need to verify data replicated between 2 directories is to compare file hashes not file sizes.
you can use the below script to identify inconsistent files
$Dir1 = "D:\SRC"
$Dir2 = "D:\DST"
$Dir1Hash = Get-ChildItem $Dir1 -recurse -file | Get-FileHash | select hash,Path,@{n='RemotePath';e={$_.path.replace($Dir1,$Dir2)}}
$Dir2Hash = Get-ChildItem $Dir2 -recurse -File | Get-FileHash | select hash,Path,@{n='RemotePath';e={$_.path.replace($Dir2,$Dir1)}}
foreach ($item in $Dir1Hash){
$ReplicaFile = $Dir2Hash | where {$_.RemotePath -eq $item.path}
if ($ReplicaFile) {
if ($item.Hash -ne $ReplicaFile.Hash){
Write-host "Incorrect hash of file: $($item.Path) on Replica folder" -ForegroundColor Cyan
}
}
else {
Write-Output "File: $($item.Path) doesn't exist on Replica Folder"
}
}