A directory doesn't have a single checksum, but the directory content does.Yes, the request can be read that way. However, that's just not possible, neither with TC nor with any other tool. A directory doesn't have a single checksum...
Therefore, it is absolutely possible to compute the checksums for the whole directory(ies) [content].
I was giving an example of that over here:
viewtopic.php?p=446869#p446869
Regarding, kb113355's specifics here, that script can be modified as follows:
- for the predefined set of folders:
Code:
$question = @(# put here each path where the folders in question reside"$env:Temp\probe\hashFolder\subfolder1","$env:Temp\probe\hashFolder\subfolder2","$env:Temp\probe\hashFolder\subfolder3","$env:Temp\probe\hashFolder\subfolder4","$env:Temp\probe\hashFolder\subfolder5")foreach ($folder in $question) {$proxy = Get-ChildItem $folder -Recurse | Get-FileHash -Algorithm SHA1| select -ExpandProperty Hash | Out-String$hash = (Get-FileHash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([char[]]$proxy))).Hash"SHA1: {0} {1}" -f $hash.ToLower(),$folder|Write-Host -f Cyan}pause
Code:
# put here the root path where the subfolders in question reside$question = "$env:Temp\probe\hashFolder"$root = Get-ChildItem $question -recurse -directoryforeach ($folder in $root) {$proxy = Get-ChildItem $folder -Recurse | Get-FileHash -Algorithm SHA1| select -ExpandProperty Hash | Out-String$hash = (Get-FileHash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([char[]]$proxy))).Hash"SHA1: {0} {1}" -f $hash.ToLower(),$folder|Write-Host -f DarkCyan}pause
Code:
# for each subfolder in the current directory (except ones which include 'unwelcomed' in their names):Get-ChildItem -directory|Where {$_.Name -notlike "*unwelcomed*"}|foreach{$proxy = Get-ChildItem $_ -Recurse | Get-FileHash -Algorithm SHA1| select -ExpandProperty Hash | Out-String$hash = (Get-FileHash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([char[]]$proxy))).Hash"SHA1: {0} {1}" -f $hash.ToLower(),$_|Write-Host -f Green}pause
Image: https://i.imgur.com/UeUlVQA.png
As we can see in the example, a pair of two folders (subfolder1, subfolder2), and a group of three folders (subfolder3, subfolder4, subfolder5) have identical SHA1 (hence, in the first approach -- the identical digital content, which in case of sha1 is still more likely than not, in everyday life).
Of course, the script can be wrapped in the TotalCommander interface (custom command, button, menu entry, whatever a user prefers).
Note: the PowerShell script here utilizes a "master hash" approach (calculates hashes of all files within a directory and uses them to create the "master hash"). And it can be pretty reasonably sufficient for some use cases.
Statistics: Posted by beb — 2024-10-22, 03:55 UTC