Skip to main content

1E 8.1 (on-premises)

FileSystem.GetDirectoryHash

Method

GetDirectoryHash

Module

FileSystem

Library

Core

Action

Returns the hash of a directory and its entire contents, including the contents of subdirectories recursively.

Parameters

DirectoryPath (string): The full path of the directory.

Algorithm (string): Which algorithm to use to perform the hashing. Possible values:

  • SHA1

  • SHA256

  • MD5

Return values

SizeBytes (int): The size of the all files in the directory

Hash (string): The SCCM 2012 hash of the directory, as there is no standard method of calculating directory hashes. On non-Windows machines this returns a hash that is different to those calculated on a Windows machine for the same data, but the result is consistent. This is typically intended to be used to check a directory's contents against another's.

Example

 FileSystem.GetDirectoryHash(DirectoryPath:"c:\\tmp", Algorithm:"MD5");

Platforms

  • Windows

  • Linux

  • MacOS

Notes

Returns SuccessNoContent if a file is supplied as the DirectoryPath parameter.

On Windows a remote directory is not supported, neither in UNC format nor using a mapped drive. This is not treated as an error but no content is returned.