A fast and simple directory tree viewer with robust filtering
Project description
dtree-cli
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
-Iflag - Show hidden files with
-aflag - 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
- Clone or download the repository
- 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:
- Lists all directories first (alphabetically sorted)
- Lists all files at the end (alphabetically sorted)
- Applies any exclusion filters you specified
- Respects the hidden file setting
- Counts total directories and files
- 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
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
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dafefaa6b224b50ccd6c5e079660c0a49477c30909bc485b2d4cdad011e722ec
|
|
| MD5 |
314d330fe3ff27b567b0af4c55b88563
|
|
| BLAKE2b-256 |
da6dbbf69071fcf83d7d9d4c4242e12dc286581aaaa7504bde6d1686c12d8b16
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5228aa2163c8c92bb914463a62322a7d11503b96108081a955a46a821f85caa
|
|
| MD5 |
098850ac46ccac4315aaeec8a4ac4da6
|
|
| BLAKE2b-256 |
1dab730e435fe1721d9bb23521a71aae846ff900d75a36b04872808bfad9396d
|