Generate ASCII or Markdown directory trees with smart filtering
Project description
filetree
Generate ASCII or Markdown directory trees with smart filtering.
Installation
pip install filetree-cli
Usage
# Basic usage - current directory
filetree
# Specific path with depth limit
filetree ~/projects -d 2
# Markdown output for documentation
filetree . --md
# Ignore additional patterns
filetree . -I "*.log" -I "tmp"
# Show only directories
filetree . -D
# Show hidden files with sizes and stats
filetree . -a --size --stats
# JSON output for programmatic use
filetree . --json
Features
- Smart defaults: Ignores common cruft (.git, node_modules, pycache, etc.)
- Depth limiting: Control how deep the tree goes
- Pattern ignoring: Glob patterns to exclude files/directories
- Multiple formats: ASCII (default), Markdown, or JSON
- Size display: Optional file size annotations
- Statistics: File/directory counts and total size
- Hidden files: Toggle visibility of dotfiles
Default Ignored Patterns
These patterns are ignored by default (use --no-default-ignore to include them):
.git,.svn,.hg__pycache__,*.pycnode_modules.venv,venv,.env*.egg-info,.pytest_cache,.mypy_cachedist,build.idea,.vscode.DS_Store
Examples
Basic Tree
$ filetree
myproject/
├── README.md
├── pyproject.toml
└── src/
├── __init__.py
└── main.py
Markdown Output
$ filetree --md
myproject/
├── README.md
├── pyproject.toml
└── src/
├── __init__.py
└── main.py
With Stats
$ filetree --stats --size
myproject/
├── README.md (1.2KB)
├── pyproject.toml (856B)
└── src/
├── __init__.py (45B)
└── main.py (2.3KB)
1 directories, 4 files
Total size: 4.4KB
JSON Output
$ filetree --json
{
"root": "/path/to/myproject",
"tree": [
"myproject/",
"├── README.md",
"├── pyproject.toml",
"└── src/",
" ├── __init__.py",
" └── main.py"
],
"stats": {
"directories": 1,
"files": 4,
"total_size": 4501,
"total_size_human": "4.4KB"
}
}
Options
| Option | Description |
|---|---|
-d, --depth N |
Maximum depth (-1 for unlimited) |
-I, --ignore PATTERN |
Patterns to ignore (repeatable) |
--no-default-ignore |
Don't use default ignore patterns |
-a, --all |
Show hidden files/directories |
-D, --dirs-only |
Show only directories |
-s, --size |
Show file sizes |
--stats |
Show summary statistics |
--md, --markdown |
Output as markdown code block |
--json |
Output as JSON |
--version |
Show version |
For AI Agents
See SKILL.md for agent-optimized documentation.
License
MIT
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
filetree_cli-0.1.0.tar.gz
(5.8 kB
view details)
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 filetree_cli-0.1.0.tar.gz.
File metadata
- Download URL: filetree_cli-0.1.0.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34df74444bd36292858c028f2ea339ecb0afd0b4590d5fcc79065ebbc9dca403
|
|
| MD5 |
ee0ed30219632c5f2ee9513af9e040e7
|
|
| BLAKE2b-256 |
ed2b3ccbece1d8048ede096a7192541a9fb15aad1c9014eb31d2380a78e7a2ce
|
File details
Details for the file filetree_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: filetree_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49725e3aeea8e7fe976a66df7109c444d2796ecddb987ce6f5c949349b3369b2
|
|
| MD5 |
0af0e30ce50fa7ca14e13a828d11af0e
|
|
| BLAKE2b-256 |
5b2c054fd7c8f952d74f13fa6f953280692c98946e4b3eb36e606a4c0208cd69
|