| Crates.io | treekyt |
| lib.rs | treekyt |
| version | 0.1.2 |
| created_at | 2025-12-31 04:45:24.63294+00 |
| updated_at | 2026-01-01 04:49:03.302919+00 |
| description | Recreate directory and file structure from `tree` command output |
| homepage | https://github.com/k0max/treekyt |
| repository | https://github.com/k0max/treekyt |
| max_upload_size | |
| id | 2013914 |
| size | 39,884 |
๐ฒ Reconstruct directory and file structures from
treecommand output โ instantly.
treekyt parses textual tree representations (like those from Unix tree or Windows tree /F) and recreates the exact nested directory and file structure on your filesystem. All files are created empty; directories are inferred automatically.
Easy for:
tree command output (e.g., from text copied from screenshots)You need Rust installed.
cargo install treekyt
# Unix/Linux/macOS
tree -F my_project | treekyt
# Or paste any valid tree structure
echo 'myapp/
โโโ src/
โ โโโ main.rs
โโโ README.md' | treekyt
treekyt --file structure.txt
By default, treekyt will skip files that already exist. To overwrite them, use the --overwrite flag:
treekyt --file structure.txt --overwrite
When an AI assistant generates a file tree, it often includes comments. treekyt automatically ignores them:
echo 'myapp # my application
โโโ src # source code
โ โโโ lib.rs # library code
โ โโโ bin # binary
โ โโโ main.rs
โโโ Cargo.toml # manifest
โโโ README.md # documentation' | treekyt
Comments (everything after # on each line) are stripped before processing, so the above creates the same structure as the uncommented version.
treekyt --help
treekyt --version
Sample --help output:
Recreate directory and file structure from `tree` command output
Usage: treekyt [OPTIONS]
Options:
-f, --file <FILE> Read input from a file instead of stdin
-o, --overwrite Overwrite existing files (default: off)
-h, --help Print help
-V, --version Print version
tree)Use tree -F to append / to directory names โ this improves parsing accuracy:
tree -F > structure.txt
treekyt -f structure.txt
tree /F)On Windows, use tree /F to include files in the output:
C:\> tree /F > structure.txt
C:\> treekyt -f structure.txt
โ
Example Windows tree /F output:
Folder PATH listing for volume Windows
Volume serial number is 1234-5678
C:.
โโโโdocs
โ notes.txt
โโโโsrc
main.rs
utils.rs
โ treekyt automatically:
C:\. or C:. as root (uses current working directory as base)docs/ and src/ are directories because they contain nested files๐ Tip: Windows
tree /Fdoes not mark directories with/, sotreekytrelies entirely on nesting depth to infer folders. Ensure your output includes files under directories โ otherwise, empty folders wonโt be detected.
treekyt automatically detects and converts multiple character encodings, making it ideal for international Windows systems.
When reading input, treekyt:
โ, โ, โ, โ, etc.)# tree /F on Chinese Windows outputs GBK-encoded bytes
tree /F > filetree.txt
# treekyt automatically detects GBK and converts to UTF-8
treekyt -f filetree.txt
Output:
โ Detected encoding: GBK
โ
Directory structure created successfully!
Input (structure.txt):
search_agent/
โโโ README.md
โโโ config/
โ โโโ api_keys.yaml
โโโ src/
โโโ core/
โโโ agent.py
Result:
search_agent/, config/, src/, core/README.md, api_keys.yaml, agent.pyโ ๏ธ Important: Files are always empty. No content is restored โ only the structure.
treekyt determines if an entry is a directory using two rules:
/ or \ โ directoryThis allows accurate reconstruction even without trailing slashes (e.g., on Windows).
Run the full test suite:
cargo test
Includes:
May support extracting file trees directly from screenshots of terminal output using OCR and tree-layout analysis.