checksum-helper


Namechecksum-helper JSON
Version 0.2.2 PyPI version JSON
download
home_page
SummaryHelper tool for checksum file operations
upload_time2023-07-08 23:22:00
maintainer
docs_urlNone
author
requires_python>=3.6
licenseMIT License Copyright (c) 2018-2023 omgitsmoe Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords script checksum verify sha512 md5 sha256 backup archival bit-rot
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # checksum-helper

Convenient tool that facilitates a lot of common checksum file operations.

Features:

- Generate checksums for a whole directory tree either verifying files based on checksum files in
  the tree or skipping unchanged files based on the last modification time
- Combine all found checksum files in a directory tree into one common checksum file while only
  using the most recent checksums and filtering deleted files (can be turned off)
- Check whether all files in a directory tree have checksums
- Copy a hash file modifying the relative paths in the file accordingly
- Move files modifying all relative paths in checksum files accordingly
- Verify operations:
    - Verify all hashes of a single file
    - Verify all checksums that were found in the directory tree
    - Verify files based on a wildcard filter

## Usage

Use `checksum_helper.py -h` to display a list of subcommands and how to use them.
Subcommands (short alias):
- incremental (inc)
- build-most-current (build)
- check-missing (check)
- copy\_hf (cphf)
- move (mv)
- verify (vf)

For almost all commands the directory tree is searched for known checksum files.
This can be customized by specifying exclusion patterns using `--hash-filename-filter [PATTERN ...]`
and the traversal depth can be limited with `-d DEPTH`.

ChecksumHelper has it's own format that also stores the last modification time as well as
the hash type. If you want to avoid a custom format you can specify a filename with
`-o OUT_FILENAME` which has to end in a hash name (based on hashlib's naming) as
extension. Single hash files won't support emitting extra warnings when doing
incremental checksums or skipping unchanged files based on the last modification
time though.

For the filter/whitelist/.. wildcard patterns:
- On POSIX platforms: only `/` can be used as path separator
- On Windows: both `/` and `\` can be used interchangeably


### incremental
```
checksum_helper incremental path hash_algorithm
```

Generate checksums for a whole directory tree starting at `path`. The tree is searched
for known checksum files (\*.md5, \*.sha512, etc.). When generating new checksums
the files are verified against the most recent checksum that was found.

`--skip-unchanged`: skip verifying files by hash if the the last modification time remains unchanged

`--dont-include-unchanged`: Unchanged files are included in the generated checksum
    file by default, this can be turned off by using this flag

`-s` or `--single-hash`: Force writing to a single hash file

### build-most-current
```
checksum_helper build path
```

Combine all found checksum files in a directory tree starting at `path` into
one common checksum file while only using the most recent checksums. By default
files that have been deleted in `path` will not be included which can be turned off
using `--dont-filter-deleted`.

### check-missing
```
checksum_helper check path
```

Check whether all files in a directory tree starting at `path` have checksums
available (in discovered checksum files)

### copy\_hf
```
checksum_helper cphf source_path dest_path
```
Copy a hash file at `source_path` to `dest_path` modifying the relative paths in
the file accordingly

### move
```
checksum_helper mv root_dir source_path mv_path
```

Move file(s) or a directory from `source_path` to `mv_path` modifying all relative
paths in checksum files, that were found in the directory tree starting at `root_dir`,
accordingly.

Make sure to be careful about choosing `root_dir` since relative paths to the moved
file(s) won't be modified in parent directories.

### verify

For all verify operations a summary containing the `FAILED`/`MISSING` files
and the amount of total files, matches, etc. are printed so you don't have to
go through all the logs manually.

Verify operations:

#### all
```
checksum_helper vf all root_dir
```

Verify all checksums that were found in the directory tree starting at `root_dir`

#### hash\_file
```
checksum_helper vf hf hash_file_name
```

Verify all hashes in a checksum file at `hash_file_name`.

#### filter
```
checksum_helper vf filter root_dir filter [filter ...]
```

Verify files based on mutiple wildcard filters such that only files matching
one of the filters is verified, assuming there is a hash in a checksum file
somewhere in `root_dir` for it.

Example:
```
checksum_helper vf filter phone_backup "*.jpg" "*.mp4" "Books/*"
```

This would verify all `jpg` and `mp4` files as well as all files in the
sub-directory `Books` (as long as there are checksums for it in `phone_backup`)

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "checksum-helper",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "script,checksum,verify,sha512,md5,sha256,backup,archival,bit-rot",
    "author": "",
    "author_email": "omgitsmoe <60219950+omgitsmoe@users.noreply.github.com>",
    "download_url": "https://files.pythonhosted.org/packages/43/be/57cf7f9b44c6f100535f7e3483074726d9eaff2b7e0327e528065f987b3d/checksum-helper-0.2.2.tar.gz",
    "platform": null,
    "description": "# checksum-helper\r\n\r\nConvenient tool that facilitates a lot of common checksum file operations.\r\n\r\nFeatures:\r\n\r\n- Generate checksums for a whole directory tree either verifying files based on checksum files in\r\n  the tree or skipping unchanged files based on the last modification time\r\n- Combine all found checksum files in a directory tree into one common checksum file while only\r\n  using the most recent checksums and filtering deleted files (can be turned off)\r\n- Check whether all files in a directory tree have checksums\r\n- Copy a hash file modifying the relative paths in the file accordingly\r\n- Move files modifying all relative paths in checksum files accordingly\r\n- Verify operations:\r\n    - Verify all hashes of a single file\r\n    - Verify all checksums that were found in the directory tree\r\n    - Verify files based on a wildcard filter\r\n\r\n## Usage\r\n\r\nUse `checksum_helper.py -h` to display a list of subcommands and how to use them.\r\nSubcommands (short alias):\r\n- incremental (inc)\r\n- build-most-current (build)\r\n- check-missing (check)\r\n- copy\\_hf (cphf)\r\n- move (mv)\r\n- verify (vf)\r\n\r\nFor almost all commands the directory tree is searched for known checksum files.\r\nThis can be customized by specifying exclusion patterns using `--hash-filename-filter [PATTERN ...]`\r\nand the traversal depth can be limited with `-d DEPTH`.\r\n\r\nChecksumHelper has it's own format that also stores the last modification time as well as\r\nthe hash type. If you want to avoid a custom format you can specify a filename with\r\n`-o OUT_FILENAME` which has to end in a hash name (based on hashlib's naming) as\r\nextension. Single hash files won't support emitting extra warnings when doing\r\nincremental checksums or skipping unchanged files based on the last modification\r\ntime though.\r\n\r\nFor the filter/whitelist/.. wildcard patterns:\r\n- On POSIX platforms: only `/` can be used as path separator\r\n- On Windows: both `/` and `\\` can be used interchangeably\r\n\r\n\r\n### incremental\r\n```\r\nchecksum_helper incremental path hash_algorithm\r\n```\r\n\r\nGenerate checksums for a whole directory tree starting at `path`. The tree is searched\r\nfor known checksum files (\\*.md5, \\*.sha512, etc.). When generating new checksums\r\nthe files are verified against the most recent checksum that was found.\r\n\r\n`--skip-unchanged`: skip verifying files by hash if the the last modification time remains unchanged\r\n\r\n`--dont-include-unchanged`: Unchanged files are included in the generated checksum\r\n    file by default, this can be turned off by using this flag\r\n\r\n`-s` or `--single-hash`: Force writing to a single hash file\r\n\r\n### build-most-current\r\n```\r\nchecksum_helper build path\r\n```\r\n\r\nCombine all found checksum files in a directory tree starting at `path` into\r\none common checksum file while only using the most recent checksums. By default\r\nfiles that have been deleted in `path` will not be included which can be turned off\r\nusing `--dont-filter-deleted`.\r\n\r\n### check-missing\r\n```\r\nchecksum_helper check path\r\n```\r\n\r\nCheck whether all files in a directory tree starting at `path` have checksums\r\navailable (in discovered checksum files)\r\n\r\n### copy\\_hf\r\n```\r\nchecksum_helper cphf source_path dest_path\r\n```\r\nCopy a hash file at `source_path` to `dest_path` modifying the relative paths in\r\nthe file accordingly\r\n\r\n### move\r\n```\r\nchecksum_helper mv root_dir source_path mv_path\r\n```\r\n\r\nMove file(s) or a directory from `source_path` to `mv_path` modifying all relative\r\npaths in checksum files, that were found in the directory tree starting at `root_dir`,\r\naccordingly.\r\n\r\nMake sure to be careful about choosing `root_dir` since relative paths to the moved\r\nfile(s) won't be modified in parent directories.\r\n\r\n### verify\r\n\r\nFor all verify operations a summary containing the `FAILED`/`MISSING` files\r\nand the amount of total files, matches, etc. are printed so you don't have to\r\ngo through all the logs manually.\r\n\r\nVerify operations:\r\n\r\n#### all\r\n```\r\nchecksum_helper vf all root_dir\r\n```\r\n\r\nVerify all checksums that were found in the directory tree starting at `root_dir`\r\n\r\n#### hash\\_file\r\n```\r\nchecksum_helper vf hf hash_file_name\r\n```\r\n\r\nVerify all hashes in a checksum file at `hash_file_name`.\r\n\r\n#### filter\r\n```\r\nchecksum_helper vf filter root_dir filter [filter ...]\r\n```\r\n\r\nVerify files based on mutiple wildcard filters such that only files matching\r\none of the filters is verified, assuming there is a hash in a checksum file\r\nsomewhere in `root_dir` for it.\r\n\r\nExample:\r\n```\r\nchecksum_helper vf filter phone_backup \"*.jpg\" \"*.mp4\" \"Books/*\"\r\n```\r\n\r\nThis would verify all `jpg` and `mp4` files as well as all files in the\r\nsub-directory `Books` (as long as there are checksums for it in `phone_backup`)\r\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2018-2023 omgitsmoe  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Helper tool for checksum file operations",
    "version": "0.2.2",
    "project_urls": {
        "Bug Tracker": "https://github.com/omgitsmoe/checksum_helper/issues",
        "Homepage": "https://github.com/omgitsmoe/checksum_helper"
    },
    "split_keywords": [
        "script",
        "checksum",
        "verify",
        "sha512",
        "md5",
        "sha256",
        "backup",
        "archival",
        "bit-rot"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "703802dbb022b4852b2cf4f7a3bbaf78c3db81da9bb3e3563963e9877d58b5db",
                "md5": "7db476ce0402b969bfc76a2a5ded7d3b",
                "sha256": "3c0b96bb6322591439535106c83c4742a953144848924bad05a0f2843f33d2dd"
            },
            "downloads": -1,
            "filename": "checksum_helper-0.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7db476ce0402b969bfc76a2a5ded7d3b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 28323,
            "upload_time": "2023-07-08T23:21:59",
            "upload_time_iso_8601": "2023-07-08T23:21:59.369239Z",
            "url": "https://files.pythonhosted.org/packages/70/38/02dbb022b4852b2cf4f7a3bbaf78c3db81da9bb3e3563963e9877d58b5db/checksum_helper-0.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "43be57cf7f9b44c6f100535f7e3483074726d9eaff2b7e0327e528065f987b3d",
                "md5": "8ecff7f16c7af4b1d7488ebfffaea1cc",
                "sha256": "9a75a69c01fb0a92e693150e274e849c2c3822d6003a551ce20ffe49b3403745"
            },
            "downloads": -1,
            "filename": "checksum-helper-0.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "8ecff7f16c7af4b1d7488ebfffaea1cc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 46090,
            "upload_time": "2023-07-08T23:22:00",
            "upload_time_iso_8601": "2023-07-08T23:22:00.952778Z",
            "url": "https://files.pythonhosted.org/packages/43/be/57cf7f9b44c6f100535f7e3483074726d9eaff2b7e0327e528065f987b3d/checksum-helper-0.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-08 23:22:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "omgitsmoe",
    "github_project": "checksum_helper",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "checksum-helper"
}
        
Elapsed time: 0.33381s