one hash for all files in folder(s)

by willbs at 2013-03-05 15:40:35

does anyone know of a routine that will create 1 hash for all of the files in a folder and in any subfolders?

i’ve looked around and couldn’t find anything, everything i saw did individual file hashes

thanks in advance
by willbs at 2013-03-06 15:32:41
i have v3 so i went out and downloaded and ran/installed Pscx-3.0.0.msi, it has the advanced zip and hash functionality, make sure you restart powershell after

what i ended up doing, is create a zip file with all of the files that i wanted in it with this function;

function CreateZIPfile([String] $aDirectory, [String] $aZipfile){
[string]$pathToZipExe = “C:\Program Files\7-zip\7z.exe”;
[Array]$arguments = “a”, “-tzip”, “$aZipfile”, “$aDirectory”, “-r”;
& $pathToZipExe $arguments;
}
# 1st folder is the source docs, 2nd folder would be the output zip file
# usage: CreateZIPfile “c:\Music*” "c:\TestZip.zip"

then i i created a hash from it using this code;

$LocalHash = get-hash C:\TestZip.zip

then copy this zip file to a remote server

Copy-Item C:\TestZip.zip -Destination \stg-53\Documents

the i get the hash of the remote zip file

$RemoteHash = get-hash \stg-53\Documents\TestZip.zip

then check it to be sure that they are the same

if ($RemoteHash.HashString -eq $LocalHash.HashString) { “nRemote and Local Hashes are the Same, PASS&quot; | out-file -filepath $global:OutputReportFile -append}<br> else { &quot;nLocal Hash $LocalHash.HashString AND Remote Hash $RemoteHash.HashString ARE NOT THE SAME, FAIL”| out-file -filepath $global:OutputReportFile -append }