Coder Social home page Coder Social logo

eibex / unchecksum Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 26 KB

Quick tool to generate and check hashes of all files in a given directory recursively

License: MIT License

Dockerfile 2.16% Python 97.84%
bitrot bitrot-detection checksum checksum-calculation checksum-generation checksum-validator docker file-integrity integrity integrity-checker

unchecksum's Introduction

unchecksum

Quick tool to generate and check hashes of all files in a given directory recursively (or compare multiple directories with threading).

How to use

python3 ./unchecksum.py "/path/of/directory/to/check"

Additional parameters:

-hs, --hash                 specify an hash between 'sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'blake2', 'md5' (default is blake2 for speed)
-a, --action                specify what action to take in case of different hashes ('warn' or 'overwrite') (default 'warn')
-c, --compare               compare the given directory against specified one with the same directory and file structure/names against each other (specified after this argument)
-cc, --calculatecompare     calculate hashes (with threading) and compare the given directory against specified one with the same directory and file structure/names against each other (specified after this argument)
-s, --skip                  skip existing known files and calculate hashes only for new files

Note: if using the --compare argument the program will not calculate hashes, but simply compare two existing sets of hashes against each other.

If no parameters are specified, the program will behave as follows: if a file (checked by filename) was never seen before, it will generate a quick checksum. If the file was already encountered (same location and filename) the checksum will be checked against the saved one. You could potentially save both checksums by renaming the directory containing the checksums under files.

Example 1 - Checking the files in-place (same path)

First run:

python3 ./unchecksum.py "/disk1"

The program will generate hashes of all your files.

Assuming you have not moved the files around, you can re-run the same command to check for silent corruption.

Example 2 - Checking the files after a copy (different path)

If you have already calculated the hashes for both directories:

python3 ./unchecksum.py "files/disk1" -c "files/disk2"

If you need to calculate hashes for both directories:

python3 ./unchecksum.py "/disk1" -cc "/disk2"

FAQ

Q: Why docker?

A: I made this to check files being copied on Unraid and did not want to install Python outside of a container ¯\(ツ)/¯ (if you actually want to use it in a docker you will have to add the -t extra-parameter to keep the docker alive or it will exit after starting)

unchecksum's People

Contributors

eibex avatar

Stargazers

 avatar

Watchers

 avatar

unchecksum's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.