Kragle provides utilities to convert a folder (directory tree) into a YAML representation (optionally with file content compression) and to recreate the original folder structure from such a YAML file. It can be used for archiving, transferring, or validating folder contents in a platform-agnostic way.
- Converts a folder and its subfolders/files into a structured YAML.
- Optionally compresses file contents using lzma and encodes them with base85
- Stores file metadata: original name, size, MD5 hash, and content (compressed/uncompressed).
- Reconstructs the original folder and file structure from the YAML, decompressing and verifying MD5 hashes automatically.
- Supports both text and compressed (binary) file contents.
You may use the script directly by editing the __main__ section:
Each directory is represented as:
name: directory_name
type: directory
children:
- ...Each file is represented as:
name: filename.txt
type: file
original_size: 123
original_md5: md5hash...
is_compressed: true
content: "... # base85-encoded lzma or raw text"When reconstructing, the script computes the MD5 hash of each written file and compares it to the hash stored in the YAML. Any mismatch will be reported in the output.