Create and validate a directory stamp based on deterministic path hashing.
Project description
Directory Validator (dirval) 📂✅
Directory Validator is a Python utility that creates and verifies a unique hash stamp for a directory. This stamp, saved as a JSON file, represents the directory’s structure (relative paths, excluding the stamp file itself), allowing you to quickly detect changes in the directory layout.
🛠 Features
- Stamp Creation: Generate a deterministic SHA-256 hash from all relative paths (files and subdirectories).
- Validation: Recalculate the hash to determine if any files or directories have changed.
- Exclusion Handling: Automatically ignores the stamp file (
directory_stemp.json) in the directory root. - Simple CLI Interface: Easily create or validate stamps via command-line options.
📥 Installation
Install Directory Validator via Kevin's Package Manager under the alias dirval:
package-manager install dirval
This installs Directory Validator globally so you can run dirval in your terminal. 🚀
🚀 Usage
Create a Directory Stamp
Generate a stamp (hash and timestamp) for a directory. The stamp is saved as directory_stemp.json inside the directory.
dirval <path_to_directory> --stamp
Validate a Directory
Compare the current directory state against the stored stamp to check for any modifications.
dirval <path_to_directory> --validate
📖 How It Works
- The script recursively walks through the given directory and collects all file and subdirectory paths (ignoring the stamp file in the directory root).
- It sorts the collected paths and computes a cumulative SHA-256 hash.
- The resulting hash, along with the current date and time, is saved in a JSON file (
directory_stemp.json) within the directory. - For validation, the script recalculates the current hash and compares it with the stored hash to detect any changes.
🧑💻 Author
Developed by Kevin Veen-Birkenbach
📜 License
This project is licensed under the MIT License. See the LICENSE file for details.
🤝 Contributions
Contributions are welcome! Feel free to fork the repository, submit pull requests, or open issues if you have suggestions or encounter any problems. Let's improve directory validation together! 😊
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dirval-1.1.2.tar.gz.
File metadata
- Download URL: dirval-1.1.2.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88e7f5fae67a7d4347a9d7dbb498c03701dc923da17e58f0aa81ee5a526461a2
|
|
| MD5 |
adf95e6b2e1aee64514d9179d8a398f3
|
|
| BLAKE2b-256 |
1bb91fc8191cd47b7203f05962a3e621e3212caee283788fe88ad7c6249a67f1
|
Provenance
The following attestation bundles were made for dirval-1.1.2.tar.gz:
Publisher:
publish-pypi.yml on kevinveenbirkenbach/directory-validator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dirval-1.1.2.tar.gz -
Subject digest:
88e7f5fae67a7d4347a9d7dbb498c03701dc923da17e58f0aa81ee5a526461a2 - Sigstore transparency entry: 763259210
- Sigstore integration time:
-
Permalink:
kevinveenbirkenbach/directory-validator@9547b48b33059682ad50738b5a43735cbe2872c8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/kevinveenbirkenbach
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@9547b48b33059682ad50738b5a43735cbe2872c8 -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file dirval-1.1.2-py3-none-any.whl.
File metadata
- Download URL: dirval-1.1.2-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81072d4c7ad1c32d1063b48d9e16ed6b42758cf55356bcd60a785868776a6be9
|
|
| MD5 |
173d8127d0591a2c5fc74cea104cc2bb
|
|
| BLAKE2b-256 |
94d325ae6a0e0d466904d793fd5334c5a4a01a8a7afd612b044d2f695eb46262
|
Provenance
The following attestation bundles were made for dirval-1.1.2-py3-none-any.whl:
Publisher:
publish-pypi.yml on kevinveenbirkenbach/directory-validator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dirval-1.1.2-py3-none-any.whl -
Subject digest:
81072d4c7ad1c32d1063b48d9e16ed6b42758cf55356bcd60a785868776a6be9 - Sigstore transparency entry: 763259211
- Sigstore integration time:
-
Permalink:
kevinveenbirkenbach/directory-validator@9547b48b33059682ad50738b5a43735cbe2872c8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/kevinveenbirkenbach
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@9547b48b33059682ad50738b5a43735cbe2872c8 -
Trigger Event:
workflow_run
-
Statement type: