Version: 12
restore

Contents

Method

FindFileBySizeAndHash

ModuleFileSystem
LibraryCore
Action

Finds a file by its size and hash.

Parameters

Size (int): the size in bytes of the file.

Hash (string): the hash of the file.

Fast (boolean; optional, default true): On Windows chooses between the fast search technology or the previous slower (but fully reliable) technology. Always used for non-Windows. New in v3.1.

Algorithm (string, optional, default "SHA256"): Selects the hashing algorithm used by this method. New in v3.3. Supported values:

  • SHA1
  • SHA256
  • MD5

This must match the Hash parameter - if you specify an MD5 hash, this parameter must also be set to MD5.

Return values

For each file found:

    • FileName (string): The full path.
Example

This will perform a fast search, looking for a file with the specified SHA-256 hash and size:

FileSystem.FindFileBySizeAndHash(Size:402, Hash:"8eda0d394c2370c4ac8562d5ae6b5e7b01f347940bc58a65ca873c33a33475a3");

This will perform a slow search, looking for a file with the specified MD5 hash and size:

FileSystem.FindFileBySizeAndHash(Size:999, Hash:"08ad2e5d7538091fbbfd352bb323e238", Fast:false, Algorithm:"MD5");
Platforms
  • Windows
  • Linux
  • MacOS
  • Solaris Intel
  • Solaris Sparc
Notes

This will search all fixed disks which is an expensive process and may take some time.

Currently files locked by some other process cannot be hashed and therefore cannot be reported as being found. This is not supported.

This will not search for files on remote machines.

This works slightly differently on Windows and Non-Windows platforms when the given file or directory where the file resides does not have any permissions assigned/available. Windows platforms do not report such locked-down files whereas non-Windows do report the files irrespective of which level permission has been denied (file or directory). This happens because the Tachyon.Agent service runs as "root" (superuser).