Tree Command
The tree command allows you to view the folder structure of a drive or path graphically. It creates a "branching" visualization that makes it easy to understand the hierarchy of your directories and files.
Usage:tree
[drive:][path]
[/f]
[/a]
/f
Displays the names of the files in each folder.
/a
Uses ASCII text characters instead of extended characters (useful if lines look weird).
Common Options
- /F: By default,
treeonly shows folders. Use/fto see files inside those folders as well. - /A: If you are sending the output to a text file or a printer that doesn't support graphical lines,
/aforcestreeto use standard text characters (+, -, |, ).
Real-World Examples
1. Basic Directory Tree
View the structure of the current directory.
Command Prompt
C:\Users\User>tree
2. Showing Files
See exactly where files are located within the structure.
Command Prompt
C:\Users\User>tree /f
3. Saving the Tree to a File
This is great for documenting your project structure.
Command Prompt
C:\Users\User>tree /f > structure.txt
Knowledge Check
1 / 2Which flag makes tree show files, not just folders?