(Directory,Draw Folder Structure) Cmd Tree Command

[Directory,Draw Folder Structure]Cmd Tree Command



[Directory,Draw Folder Structure]Cmd Tree Command

Right,So This Is How You’d Go About Drawing
And Saving Directory And Folder Structures Using
The Tree Command In Windows cmd.

1. Outputting Only Folders In A Tree Structure.

1
$ tree {Folder Name}

2. Including files in the tree structure

1
tree /f {Folder Name}

3. Displaying the tree structure using ASCII characters

1
tree /f /a {Folder Name}

4. Saving the output results (Redirect Output)

  • You Use The Cmd’s Redirect Output Overwrite And Append Characters,
    >and>>,To Save The Output Results.
1
2
3
4
# 1. Creating a File (if a file with the same name exists,it will be overwritten)
$ tree Folder Name > File Name
# 2. Appending content (appending content to the existing file)
$ tree Folder Name >> File Name

The final output looks like this below.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
> tree Directory Name
--- Output Type 1 ---
D:.
├─SQL Expert Guide Practice Files
├─Problems
│ ├─21, 24, 25, 26, 30th Exam Collection
│ ├─21st Exam
│ ├─30th Exam
│ ├─34th Exam
│ └─Short Answer Question Collection
└─Theory_Textbook

> tree /a Directory Name
--- Output Type 2 (/a option used) ---
+---SQL Expert Guide Practice Files
+---Problems
| +---21, 24, 25, 26, 30th Exam Collection
| +---21st Exam
| +---30th Exam
| +---34th Exam
| \---Short Answer Question Collection
\---Theory_Textbook

5. Saving the output results

1
$ tree /f /a > Desired File Name.txt