dirhash1
Python module and cli for hashing of file system directories.
Overview
usage: dirhash [-h] [-v] [-a] [-m [...]] [-i [...]] [--empty-dirs]
[--no-linked-dirs] [--no-linked-files] [-p
|
[...]] [-c] |
|---|---|
|
[-s CHUNK_SIZE] [-j JOBS] [-l] directory |
Determine the hash for a directory.
positional arguments:
- directory
-
Directory to hash.
optional arguments:
-
-h, --help -
show this help message and exit
-
-v, --version -
show program's version number and exit
-
-a , --algorithm -
Hashing algorithm to use, by default "md5". Always available: ['md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512']. Additionally available on current platform: ['blake2b', 'blake2s', 'md4', 'md5-sha1', 'ripemd160', 'sha3_224', 'sha3_256', 'sha3_384', 'sha3_512', 'sha512_224', 'sha512_256', 'shake_128', 'shake_256', 'sm3', 'whirlpool']. Note that the same algorithm may appear multiple times in this set under different names (thanks to OpenSSL) [https://docs.python.org/2/library/hashlib.html]
Filtering options:
-
Specify what files and directories to include. All files and directories (including symbolic links) are included by default. The
--match/--ignore arguments allows for selection using glob/wildcard (".gitignore style") path matching. Paths relative to the root `directory` (i.e. excluding the name of the root directory itself) are matched against the provided patterns. For example, to only include python source files, use: `dirhash path/to/dir-m"*.py"` or to exclude hidden files and directories use: `dirhash path/to.dir-i".*" ".*/"` which is short for `dirhash path/to.dir-m"*" "!.*" "!.*/"`. By adding the--listargument, all included paths, for the given filtering arguments, are returned instead of the hash value. For further details see https://github.com/andhus/dirhash/README.md#filtering
-
-m -
[ ...],
--match[ ...] One or several patterns for paths to include. NOTE: patterns with an asterisk must be in quotes ("*") or the asterisk preceded by an escape character (\*).
-
-i -
[ ...],
--ignore[ ...] One or several patterns for paths to exclude. NOTE: patterns with an asterisk must be in quotes ("*") or the asterisk preceded by an escape character (\*).
-
--empty-dirs -
Include empty directories (containing no files that meet the matching criteria and no non-empty sub directories).
-
--no-linked-dirs -
Do not include symbolic links to other directories.
-
--no-linked-files -
Do not include symbolic links to files.
Protocol options:
-
Specify what properties of files and directories to include and whether to allow cyclic links. For further details see https://github.com/andhus/dirhash/DIRHASH_STANDARD.md#protocol
-
-p -
[ ...],
--properties[ ...] List of file/directory properties to include in the hash. Available properties are: ['name', 'data', 'is_link'] and at least one of name and data must be included. Default is [data name] which means that both the name/paths and content (actual data) of files and directories will be included
-
-c, --allow-cyclic-links -
Allow presence of cyclic links (by hashing the relative path to the target directory).
Implementation options:
-
-s CHUNK_SIZE, --chunk-size CHUNK_SIZE -
The chunk size (in bytes) for reading of files.
-
-j JOBS, --jobs JOBS -
Number of jobs (parallel processes) to use.
Special options:
-
-l, --list -
List the file paths that will be taken into account, given the provided filtering options.
Releases
Unchanged in 2 releases since Debian 12 (Bookworm).