2

I need to send someone a 10GB file that has inside several thousands of files. I know that in Ubuntu you can use the next command in the terminal: md5sum <directory_name> and this returns a hash.

I am using Windows 11 and I have tried several things:

  • First I tried calculating the hash of just one file: CertUtil -hashfile .\file.png MD5 and this returned me a hash value.
  • Then I tried the same but with the whole directory containing all the files: CertUtil -hashfile "path_to_directory\*" MD5 but I get an error.

Error:

CertUtil: -hashfile error del comando: 0x80070002 (WIN32: 2 ERROR_FILE_NOT_FOUND)
CertUtil: El sistema no puede encontrar el archivo especificado.

What should I do?

Linux
  • 135
  • 1
  • 5

1 Answers1

0

You can do it with PowerShell, for instance:

$hashString = (Get-ChildItem C:\Somedir -Recurse -File | Get-FileHash -Algorithm MD5).Hash | Out-String
(Get-FileHash -Algorithm MD5 -InputStream ([IO.MemoryStream]::new([char[]]$hashString))).Hash

Source, I modified it slightly to only get hash from files (otherwise a bunch of errors for subdirs appear) and just return the hash.

This basically gets all file hashes recursively, prints them to one string, then creates a temporary stream from that string and calculates its hash.

Alternatively, output the hashes string to a file with > operator ($hashString > file.txt) and then compare files.

Destroy666
  • 12,350