Skip to content

Rushabh5000/dir-tree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dir-tree

Zero dependencies Node License: MIT Platform

Cross-platform tree with file sizes, item counts, and .gitignore awareness. Zero dependencies.

Windows tree is bare. GNU tree doesn't ship by default on macOS. tree-cli (npm) has deps.


Install

npm install -g dir-tree

Or without installing:

npx dir-tree

Usage

dir-tree                       # Current dir, default depth 4
dir-tree src/ -L 2             # 2 levels deep
dir-tree --size --count        # Show sizes and item counts
dir-tree -a                    # Include hidden files
dir-tree -d                    # Directories only
dir-tree --json                # JSON output

Example Output

my-project  (12.4M, 142 items)
├── README.md  (4.2K)
├── package.json  (1.1K)
├── src  (892K, 38 items)
│   ├── api  (245K, 12 items)
│   │   ├── users.js  (18.4K)
│   │   └── auth.js  (12.1K)
│   ├── components  (412K, 18 items)
│   └── utils.js  (8.2K)
└── tests  (124K, 22 items)

  4 directories, 8 files, 12.4M total

.gitignore Awareness

By default, dir-tree reads .gitignore files in each directory and skips matching entries. So your node_modules, dist, *.log, etc. won't clutter the output.

Disable with --no-gitignore.


Color Coding

Files are colored by type:

  • Bold blue — directories
  • Yellow — JS, Python, shell scripts
  • Blue — TypeScript, CSS
  • Green — JSON, YAML, shell, batch
  • Cyan — Markdown, images
  • Red — HTML, archives, Ruby/Rust

Options

Flag Default Description
-L, --depth <N> 4 Max depth to descend
-a, --all off Show hidden files
-d, --dirs-only off Show directories only
--size off Show file/directory size
--count off Show item count per directory
--no-gitignore off Don't read .gitignore
--json off Output as JSON tree

License

MIT


Keywords

tree command · directory tree · tree cli · folder structure · tree windows · list files tree · tree-cli alternative · gitignore aware · cross-platform · zero dependencies


Built to solve, shared to help — Rushabh Shah 🛠️✨

One of 40+ zero-dependency developer CLI tools — no node_modules, ever.

Releases

No releases published

Packages

 
 
 

Contributors