Skip to main content

A fast and simple directory tree viewer with robust filtering

Project description

dtree-cli

Python Version License Platform Status

A fast and simple directory tree viewer with robust filtering capabilities. Works on Windows, macOS, and Linux.

Features

  • Display directory structure in a clean tree format
  • Color-coded output (directories in blue, files in white)
  • Multiple output styles: box, simple, arrow, dots
  • Filter out specific folders and files with -I flag
  • Show hidden files with -a flag
  • File and directory counts at the bottom
  • Directories shown first, files at the bottom
  • Works universally across Windows (PowerShell/CMD), macOS, and Linux

Installation

Via pip (Recommended)

pip install -e .

Then use it anywhere:

dtree

Manual Setup

  1. Clone or download the repository
  2. Install with pip in editable mode from the project directory:
    pip install -e .
    

Usage

Basic Usage

Display the current directory:

dtree

Display a specific directory:

dtree /path/to/directory

Options

Ignore Folders and Files

Use -I or --ignore to exclude specific items (space-separated):

dtree -I vendor node_modules
dtree -I .git .env

Show Hidden Files

Use -a or --all to include hidden files (starting with .):

dtree -a
dtree -a -I vendor

Change Output Style

Use -s or --style to change the tree connector style:

dtree -s simple      # +-- style
dtree -s arrow       # -> style
dtree -s dots        # . style
dtree -s box         # ├── style (default)

Disable Colors

Use --no-color to remove colored output:

dtree --no-color
dtree -I vendor --no-color

Examples

Display current directory with vendor folder excluded:

dtree -I vendor

Show all files including hidden ones, excluding .git and node_modules:

dtree -a -I .git node_modules

Display a specific directory with simple style and no colors:

dtree /home/user/project -s simple --no-color

Styles

Box (Default)

├── folder
│   └── file.txt
└── file2.txt

Simple

+-- folder
|   +-- file.txt
+-- file2.txt

Arrow

→ folder
  → file.txt
→ file2.txt

Dots

· folder
  · file.txt
· file2.txt

Combining Flags

You can combine multiple flags:

dtree -a -I .git vendor -s arrow
dtree /path/to/dir -I node_modules .env -s simple --no-color

Requirements

  • Python 3.7 or higher
  • No external dependencies

How It Works

dtree recursively traverses your directory structure and displays it in a tree format. It:

  1. Lists all directories first (alphabetically sorted)
  2. Lists all files at the end (alphabetically sorted)
  3. Applies any exclusion filters you specified
  4. Respects the hidden file setting
  5. Counts total directories and files
  6. Applies color and style preferences

Supported Platforms

  • Windows (PowerShell and Command Prompt)
  • macOS
  • Linux

All platforms support ANSI color codes, making colored output work everywhere.

License

MIT License - feel free to use and modify as needed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dtree_cli-1.0.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dtree_cli-1.0.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file dtree_cli-1.0.0.tar.gz.

File metadata

  • Download URL: dtree_cli-1.0.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for dtree_cli-1.0.0.tar.gz
Algorithm Hash digest
SHA256 dafefaa6b224b50ccd6c5e079660c0a49477c30909bc485b2d4cdad011e722ec
MD5 314d330fe3ff27b567b0af4c55b88563
BLAKE2b-256 da6dbbf69071fcf83d7d9d4c4242e12dc286581aaaa7504bde6d1686c12d8b16

See more details on using hashes here.

File details

Details for the file dtree_cli-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: dtree_cli-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for dtree_cli-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c5228aa2163c8c92bb914463a62322a7d11503b96108081a955a46a821f85caa
MD5 098850ac46ccac4315aaeec8a4ac4da6
BLAKE2b-256 1dab730e435fe1721d9bb23521a71aae846ff900d75a36b04872808bfad9396d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page