Skip to main content

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__, *.pyc
  • node_modules
  • .venv, venv, .env
  • *.egg-info, .pytest_cache, .mypy_cache
  • dist, 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

Release files for filetree-cli 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for filetree-cli 0.1.0
File Size Uploaded
filetree_cli-0.1.0.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for filetree-cli 0.1.0
File Interpreter ABI Platform
filetree_cli-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.0 kB

Release files / filetree_cli-0.1.0.tar.gz

Download URL filetree_cli-0.1.0.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
34df74444bd36292858c028f2ea339ecb0afd0b4590d5fcc79065ebbc9dca403
BLAKE2b-256 checksum
How to use checksums
ed2b3ccbece1d8048ede096a7192541a9fb15aad1c9014eb31d2380a78e7a2ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / filetree_cli-0.1.0-py3-none-any.whl

Download URL filetree_cli-0.1.0-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
49725e3aeea8e7fe976a66df7109c444d2796ecddb987ce6f5c949349b3369b2
BLAKE2b-256 checksum
How to use checksums
5b2c054fd7c8f952d74f13fa6f953280692c98946e4b3eb36e606a4c0208cd69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page