Version: 8
restore

Contents

Method

FindFileBySizeAndHash

ModuleFileSystem
LibraryCore
Action

Finds a file by size and hash.

Parameters

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

Hash (string): the SHA-256 hash of the file.

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

Algorithm (string, optional, "SHA256"): This selects the hashing algorithm used by this method. By default, this is set to "SHA256" for backwards compatibility. This parameter must match the Hash parameter - if you specify an MD5 hash, this parameter must also be set to MD5. New in v3.3. Possible values:

  • SHA1
  • SHA256
  • MD5
Return values

For each file found:

    • FileName (string): The full path.
Example
 FileSystem.FindFileBySizeAndHash(Size:402, Hash:"8eda0d394c2370c4ac8562d5ae6b5e7b01f347940bc58a65ca873c33a33475a3");
 
 // This will perform a slow search, looking for a known MD5 hash and size.
 FileSystem.FindFileBySizeAndHash(Size:999, Hash:"08ad2e5d7538091fbbfd352bb323e238", Fast:false, Algorithm:"MD5");
Platforms
  • Windows
  • Linux
  • MacOS
  • Solaris Intel
  • Solaris Sparc
  • Android - no
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 different on Windows and Non-Windows platform when the given file or folder, where file resides do not have any permissions assigned/available.

Windows platform does not report such locked down files whereas Non-windows does report the files irrespective of which level permission has been denied (file or folder). This happens because the tachyon.agent service runs as "root" (superuser)