Compare folder contents via hash.
Project description
Compare folder contents via hash. File I/O and hashing are done in threads using the Curio library to make the comparison as speedy as possible!
I use folderhash
for extra assurance that large or important file copies have been performed accurately.
Installation
At the moment, installation must be performed via GitHub:
$ pip install git+git://github.com/scolby33/folderhash.git
folderhash
supports only Python 3.6 or later.
Demo
$ mkdir -p /tmp/demo/a /tmp/demo/b # just some setup
$ cd /tmp/demo
$ touch a/a a/b a/c b/a b/b b/d
$ echo "DIFFERENT CONTENT" >> a/b
$ folderhash a b # the simplest case--compare two folders
9fb5d41e2533b73381bdde8e3ac2d60a6a18467674771187595d83e9bfa30909 /tmp/demo/a/b
a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a /tmp/demo/b/b
a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a /tmp/demo/a/c
ABSENT /tmp/demo/b/c
ABSENT /tmp/demo/a/d
a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a /tmp/demo/b/d
$ # you can change the hash algorithm!
$ # all of the algorithms in your Python's `hashlib` are available
$ # default is sha3_256
$ folderhash -s md5 a b
128edd12d0b04e23d10c4747d0da2c03 /tmp/demo/a/b
d41d8cd98f00b204e9800998ecf8427e /tmp/demo/b/b
d41d8cd98f00b204e9800998ecf8427e /tmp/demo/a/c
ABSENT /tmp/demo/b/c
ABSENT /tmp/demo/a/d
d41d8cd98f00b204e9800998ecf8427e /tmp/demo/b/d
$ # it works with relative paths, too
$ cd a
$ folderhash . ../b
9fb5d41e2533b73381bdde8e3ac2d60a6a18467674771187595d83e9bfa30909 /tmp/demo/a/b
a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a /tmp/demo/b/b
a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a /tmp/demo/a/c
ABSENT /tmp/demo/b/c
ABSENT /tmp/demo/a/d
a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a /tmp/demo/b/d
$ # you can do the hashing separately and compare at a later time
$ cd ..
$ folderhash a > a.txt
$ folderhash b > b.txt
$ folderhash -a a.txt -b b.txt
9fb5d41e2533b73381bdde8e3ac2d60a6a18467674771187595d83e9bfa30909 /tmp/demo/a/b
a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a /tmp/demo/b/b
a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a /tmp/demo/a/c
ABSENT /tmp/demo/b/c
ABSENT /tmp/demo/a/d
a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a /tmp/demo/b/d
$ # the format of the hash files is simple: {hash_value}<SP>{full_path}
$ cat a.txt
a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a /tmp/demo/a/a
9fb5d41e2533b73381bdde8e3ac2d60a6a18467674771187595d83e9bfa30909 /tmp/demo/a/b
a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a /tmp/demo/a/c
Contributing
There are many ways to contribute to an open-source project, but the two most common are reporting bugs and contributing code.
If you have a bug or issue to report, please visit the issues page on Github and open an issue there.
License
MIT. See the LICENSE.rst
file for more information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for folderhash-1.0.0-py36-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4fd32e212a74a8b44d7ac4cfd01b52d3d85c48d9f9361577cd6b7261c4dddcaa |
|
MD5 | c8b46cb05eb0621adabefb41026e2b80 |
|
BLAKE2b-256 | 3cb989f7d874dcd4caa9f39c47e3a4eaddd646a1505e85a2f82d66129e5c15fd |