The Windows TREE command prints a folder hierarchy as a text tree. When a project has nested src, tests, docs, and build output, tree shows the shape in one glance — no clicking through Explorer windows.
Microsoft’s reference: TREE command.
What does TREE do?
tree
From the current directory, CMD draws every subdirectory using line characters. Folders nest under parents so you can see depth and structure immediately.
Useful TREE flags
/f — include files
tree /f
Shows folders and files. Perfect for understanding what actually lives in a repo or project folder.
/a — ASCII characters
tree /a
Uses plain +-- style characters instead of box-drawing glyphs. Better for logs, older fonts, and copy-paste into chats that mangle Unicode.
Point at a path
tree C:\Projects\my-app /f
You do not have to cd first — pass the path as an argument.
Practical workflows
Map a project before you change it
cd /d C:\Projects\my-app
tree /f
You will spot leftover node_modules, old dist folders, or misplaced configs fast.
Save a structure snapshot
tree /f > structure.txt
Commit structure.txt in docs, or attach it to a ticket so others see the layout without cloning yet.
Keep output readable
Huge trees (with node_modules) are noisy. Either:
cd src
tree /f
or exclude heavy folders by running TREE from a narrower path.
TREE vs DIR /s
| Need | Prefer |
|---|---|
| Visual hierarchy |
tree / tree /f
|
| Flat recursive file hunt | dir /s *.ext |
| Scriptable name list | dir /b /s |
Use TREE to understand shape. Use DIR to find or list specific files.
Practice folder mapping hands-on
Once you can read a tree dump, navigating and cleaning projects gets easier.
CMD Master is a free online interactive learning platform for the command line. Learn Windows CMD, PowerShell, and Bash in a browser terminal with instant feedback — no install required. Most lessons are free; the Windows Command Prompt course covers core file and folder skills step by step.
Top comments (0)