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.
Try the command
Visualize the folder structure!
Build the command
tree
Terminal
C:\Users\User>tree C:\ /f /a
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?
References
These documentation links provide authoritative details for the commands used in this article.