What is up everybody this is Jason with Dev soapstar calm and in this video we are going to learn how
to delete files directories and directories with crap like other files.
You don't want or need.
Right.
So let's do it.
So we've got a lot of ish here on the terminal so let's go ahead and clear that up.
So I'm just going to type in the clear command you know what.
You can also do an attack command a K which will just also clear everything up for you.
So let's learn how to delete files.
So right now we're in our services folder.
Right.
And our boss comes to us and he's like dude why did you create this cat javascript file.
Like are you trying to teach kids how to Miano like flight.
Does it really work.
And so he needs us to get rid of it.
So what we can do is we can use a command called r.p.m..
So our M stands for.
Remove and remove the file.
We're now going to write the file name.
So Katz dot J.
S. boom it's gone.
I love it.
All right.
Now say your boss comes to you and says dude you made a lot of ridiculous files in here like.
Like just get rid of these things.
Well we can actually delete multiple files with this command just like we use the touch command to create
multiple files.
We can do the same thing to get rid of them.
So our AM.
We don't need the services file any more even though it's packed full of useful information and we don't
need the master javascript file either.
So go ahead and hit enter and walla.
You see it over here in the Finder that the files have been removed.
That's fantastic.
All right.
So pretty easy stuff right.
Well let's move on to deleting and getting rid of a directory here.
All right so we've got a services directory which is completely empty.
And then you can see here that we've got this javascript directory which is completely empty.
And what I'm going to do real fast.
Wolmarans services why don't we just throw two files back in here and we're going to use it in a little
bit for another demonstration here.
So touch mange.
Yes.
And then we'll throw in an H you know file or something.
All right cool.
So in our services we now have these two files.
All right so we're going to go back a directory over here.
So we're in our services we're going to step back here.
See the dot dot and we're in our root directory here.
And what I want to do is remove an entire directory.
Now there's actually two ways of doing this.
All right.
Which is set up really smart so you can remove a directory that's empty.
All right.
There's a command for that and there's also a command to remove a directory that is full of files because
how like tragic and ridiculous Would that be if you could remove a directory full of files and you didn't
mean to remove it because it's full of really important stuff and you deleted it and it was gone forever.
All right.
Now one thing that is so important to note that when we're using this remove command in the terminal
your stuff is permanently deleted.
It is new.
It is out of this world it might be on a flat earth but it's not on this round earth.
All right.
So it's gone.
It's not like the finder where you delete a file and it appears in your trash can.
It's news forever.
Remember that burned into your brain.
All right so we're going to learn how to delete a directory that has nothing in it.
So that's going to be this javascript file or folder.
I apologize.
So we're going to use the r m Dearmer.
Kind of looks familiar right because we did M-K Derf for make directory.
Well this is our door for.
Remove directory.
Now I already know this is going to remove this empty javascript directory but I want to I want to show
you the error.
It's going to give us if we try to remove a directory full of files.
So in this example I'm going to try out services and it says do the directories not empty.
Meaning I can't use this command there which is great.
All right.
So let's try this again.
R m Dern J.S..
OK this is an empty directory.
Boom there it is.
It's gone forever.
There's no way of ever ever getting it back.
All right.
So pretty easy now.
Let's learn how to remove a directory that is full of files.
So to do that we're going to do our.
D'oh.
Dash capital are OK.
Services BOUM all and that did not work for us and I checking it out I actually use the wrong syntax
here.
So to type this incorrectly it would be our m dash capital R.
We don't need the dollar.
All right.
And then services.
All right so now this command is going to allow us to delete a directory with files in it.
All right go ahead and press enter and poof it's gone it's gone forever so that is it.
That is a wrap for this video we have covered some very important commands in the terminal.
We have learned how to delete files delete directories and the super awesome special command to delete
directories with files in them.
All right let's move on.