And while you're at it, if you want to force tree to always colorize the output, you can always edit the main method of the tree.c file and add forcecolor=TRUE; before setLocale(LCTYPE,'); Finally hit make and you're done building tree for mac.
Window 10 has a File Explorer popularly known as Windows Explorer. This helps to view or open files quickly in Windows operating system (similar to Finder in macOS). You can navigate through the directories using back, forward, up menus, navigation menus on the top bar, directly entering location in the address bar and using left or right panes. But all these will not give you a complete structure of a directory showing the files inside a directory in a tree view. In this guide, we will show you how to use tree command in File Explorer and in the command prompt.
Related:How to create system restore point in Windows 10?
What is Tree View?
Let us take an example of a Bootstrap project folder like below having different folders for CSS stylesheets and JavaScript (JS) files.
The files structure could be more complex like below that each folder may have multiple files.
There are no ways in Windows Explorer, you can understand the entire structure of a directory. Every time you should use navigations to move up or down to find a file. It is essential in a project to have files under correct folder and use the relative path when linking files in other documents. Here comes the use of tree structure. There is a ‘Tree’ command in Windows which allows you to view the files/folders in a tree-like structure. You can really download the structure of any directory using tree command and use for reference.
How to Download Tree View of Directories in Windows 10?
Tree Command For Macos 10
There are two ways to view the folders in a tree structure.
- Using tree command in File Explorer
- Get tree structure from command prompt
View Tree Structure in Windows Explorer
There is not a direct way of viewing the folders/subfolders/files in Windows Explorer in a tree format. Tree command works in Windows Explorer but in a slightly different way. It uses the command prompt to create a file for the tree view. Let’s see how to do this.
- Press ‘Win + E’ shortcut keys and open the ‘File Explorer’ or open it by double clicking on ‘This PC’ from your desktop. Navigate to the folder from where you want to perform this command or to view its structure. In our case, we go to ‘SWSetup’ folder.
- Go to the address bar and type the command like below:
Syntax of Tree command:
- cmd /c is used to trigger command prompt.
- Tree is the command name to generate the structure.
- /F is to list down the list of all the files in every folder. Without this parameter only folders without files will be listed.
- /A for exporting the result in a file.
- > Resultant.txt is the name of the file in text format, you can also use something like tree.doc to generate the file in document format.
- Press enter key from the keyboard. After this, a new file with the name ‘Resultant’ will be created in the SWSetup folder.
- Double-click on the file and you can be able to see the structured tree format of all files in SWSetup folder.
Resultant Tree View of Directory
You can generate the tree structure for any specific folder. If the folder is located in ‘D:test’ then you should use the below command in the File Explorer address bar. It will generate a ‘tree.doc’ file in ‘D:test’ folder.
Related:Fix slow laptop and speedup Windows 10.
Tree Command For Mac
View Tree Structure Using Command Prompt
Now, you can use the Tree command in command prompt and can view the tree structure format of all the files right there. Follow the steps given below:
- Go to the ‘Start’ menu, type ‘Command Prompt’ and hit ‘Enter’ key from the keyboard.
- Type ‘CD’ command and then give the path of the folder/subfolder/drive for which you want the tree view. In our case, it’s our user folder so, the path would be (CD C:usersyourname).
Here, you can use the ‘Tree’ command in two ways. One way is to directly just using tree command and view the file structure. The problem with this way is that sometimes, there may be so many files. You cannot view all of them right there because it keeps on scrolling downwards. It will be too fast and increase the buffer size also. The second way is that you can export it to a simple text file as we have done before but this time through CMD.
Tree Command For Macos Windows 7
- For a quick view, navigate to the folder/drive for which you want to see the structure. Type the ‘Tree’ command and hit enter key. Make sure you’re using this command where the number of folders are less.
Simple Tree Command to View Files
- To download the content in a separate file, type ‘tree /f /a > Resultant.txt’ and press enter key. Now, go back to the folder and you will find a file generated with a name ‘Resultant’. Open the file to see a clean structured tree format of the selected directory.
You can also use Windows PowerShell instead of Command Prompt to view the tree structure of any directory.