Welcome back.
So in this video I'm going to show you how to work with the tree command.
So let's go to power shall again start menu type and show.
And the first thing I want to do is type in tree OK.
So you can see here.
Let's maximize this window.
I'm a scrub here a little bit as you kind of see what we are doing.
I did a tree from
the C drive so basically what we got.
I mean typing clear this you can see and then I'll do Alaska which is what we learned in the previous
video.
Basically what happened was I ran a tree and it gave me every single directory and file directory.
It listed every directory in all of these folders.
OK.
So now if I do see the and I do documents let's just do documents and then I do tree OK.
Now it's going to still have a lot but not as much because again we're just doing da tree inside of
documents.
So if I clear that and I do see these and we go to downloads I actually just do dot dot and then do
see these downloads
then the tree.
OK.
Now you can see we have a lot of files here directories but missing.
Let's go up.
This is only in downloads.
So what it's doing and let me double click on this top power here to kind of bring it down a little
bit.
I'm going to hit a window key again and we're going to go inside of the downloads folder.
And so what you're getting here is when I go to this command and type entry what it's doing is it sent.
OK.
Let me go inside here and open and see how many folders we have inside.
And then I'm going to map this out so I can see exactly what I have.
And this essentially is the idea behind web development as well.
I'm a web developer myself.
But the cool thing about tree is you can see all your folders at least not files.
So I want to make that clear you cannot see the files you see here we have files right here.
It's not going to list all that because this is a tree we're doing a directory tree.
And what it's doing is it's just showing folders that way you can see OK I have the main folder here
and then a sub folder and then inside of that we have three sub folders and then some folder and then
two more sub folders.
So we have kind of a complex tree right here but we can see everything.
So this is a way you can map things out and you could really use this for building site maps and other
things because it's it's really cool.
This is a really cool command.
I use this all the time.
I love using Tree.
Tree is like my favorite command when I'm doing file organization specifically because it really makes
it easy to look at all your file folders and see what's what.
So let me do clear OK I would do alas.
And then let's go inside of a directory and let's do start bootstrap OK.
So see these start bootstrap now you're going to have a different folder so just pick one and do see.
And then select that one.
I mean do.
Alas I'm a new tree.
Now you're going to see I only have this right here the main folder and then three sub folders and then
a sub folder and then two more inside of there.
So it's basically just showing me a visual view of this so that's what's cool about it as it really
makes it easy to see what you have and you don't have to guess.
You don't have the gas.
So here's another example.
If I go if I just see these dot dot I do allies.
I see that dot.
Tell us then let's To see the desktop guy.
I clear and I'm going to do tree no sub folders exist.
So you see what the main purpose of tree is to show sub folders.
So if I went into the gooey here and I created folder and we'll call this learned power shell game.
I'll open up learn power show and I'll do I'll do our air sample.
01
sample Well 0 2.
OK.
So now when I do tree there you go.
I have zero unlearned power show and then I have 0 1 samples 0 1 and then 0 2 samples 0 2.
Now you don't have to label everything with numbers but here's what I would tell you if you give it
a new numerical abbreviation at the beginning what that's gonna do is it's going to simplify when you're
searching and when you're changing directories if you just S.D. 01 and you had tab I don't have to type
out learn I just.
And then if I want to change to 0 2 so if I want to change that this I do see these 0 2 and then you
go and then I can do tree.
There's not gonna be anything in there because there's no sub folders that exist but if I just see these
dot dot and then see dot dot and then class and then tree.
OK.
Now I have what I had before and what what I don't have though is I don't have anything inside of here.
So we could do content and now if I do tree it's going to show that content right.
If I if I right click on this and copy it and then go to sample to paste it in there.
Now the shortcut sorry paste in the content there.
Type in tree.
Okay.
Now I have sample one as content sample to us content.
So this is a way where you can see exactly what you have in there and you can word it however you want.
But what that does is this will make you use folders instead of just leaving open files out.
Now you don't have to do that but one of the reasons why you'd want to is that way you can see everything
and it's organized and you don't have to guess where it is.
Because I'm gonna tell you I've dealt with situations where I walked into a place where they had stuff
everywhere and I couldn't find anything so a little organization takes you a long way especially with
file management.
It's very important.
So.
But this is just an example of tree and why you would want to use tree.
It's a great command.
It's a great tool to use in power show.
It's one that I use all the time.
Now I'm going to give you another example.
So just follow along with us when you don't have to actually do anything but actually you can follow
along.
You can do this.
So in in the desktop if we type in tree I can go here I can copy this.
I can go here and I hit control C to copy that I do the start menu and I type in notepad.
OK.
I'll bring that over here because I've done monitors.
Right click it paste you see what that did.
Now I have the tree so I have learned power shall samples 0 1 and then other content inside and then
samples 0 2 and then content inside.
And what that does is now if I wanted to print off this directory I could I could print it off and I
would know exactly what I have on my computer.
If you wanted to do that if you wanted to be able to track it.
I use this for my business learned type plus for creating file management everything that I do I use
power shall for.
And this is one of the reasons why I'm so passionate and so ecstatic about teaching you about power
shell because it is the most amazing to all I've ever used and tree is the tool that I use the most
because I wanted to figure out how to see the tree of files or folders so that I could visually see
what I have.
Because when you come here and you see this OK I can see I have sample one and sample two but I don't
see what's inside of there.
It's a mystery and there's no way in windows right now.
There's no way in Windows to visually see that on a Mac.
You could visually see that because what they do is they have a grid.
And so this would be the folder.
This would be the next.
This would be the sub folder that would be the sub folder of the sub folder but in windows they don't
have that.
So this is really the only way to see that at this point and you can do it through the tree command.
So that's all I have for this video.
I'll see in the next video.
Thanks for watching.