1
00:00:07,250 --> 00:00:09,900
What is up everybody this is Jason with soapstar.

2
00:00:09,910 --> 00:00:17,600
Com and in this video we are going to learn how to delete files directories and directories with crap

3
00:00:18,170 --> 00:00:19,580
like other files.

4
00:00:19,700 --> 00:00:20,630
You don't want or need.

5
00:00:20,630 --> 00:00:21,390
Right.

6
00:00:21,410 --> 00:00:23,040
So let's do it.

7
00:00:23,060 --> 00:00:29,210
So we've got a lot of ish here on the terminal so let's go ahead and clear that up.

8
00:00:29,210 --> 00:00:32,410
So I'm just going to type in the clear command you know what.

9
00:00:32,450 --> 00:00:40,340
You can also do an mak command K which will just also clear everything up for you.

10
00:00:40,430 --> 00:00:44,280
So let's learn how to delete files.

11
00:00:44,540 --> 00:00:47,660
So right now we're in our services folder.

12
00:00:47,690 --> 00:00:48,460
Right.

13
00:00:48,470 --> 00:00:53,920
And our boss comes to us and he he's like dude why did you create this cat javascript file.

14
00:00:53,930 --> 00:00:59,360
Like are you trying to teach kids how to Miano like that doesn't really work.

15
00:00:59,390 --> 00:01:01,010
And so he needs us to get rid of it.

16
00:01:01,010 --> 00:01:06,210
So what we can do is we can use a command called r.p.m..

17
00:01:06,290 --> 00:01:07,760
So our M stands for.

18
00:01:07,760 --> 00:01:10,000
Remove and remove the file.

19
00:01:10,010 --> 00:01:12,000
We're now going to write the file name.

20
00:01:12,050 --> 00:01:13,580
So Katz dot J.

21
00:01:13,580 --> 00:01:16,040
S. boom it's gone.

22
00:01:16,040 --> 00:01:17,210
I love it.

23
00:01:17,210 --> 00:01:17,660
All right.

24
00:01:17,660 --> 00:01:23,160
Now say your boss comes to you and says dude you made a lot of ridiculous files in here like.

25
00:01:23,510 --> 00:01:25,240
Like just get rid of these things.

26
00:01:25,250 --> 00:01:31,460
Well we can actually delete multiple files with this command just like we use the touch command to create

27
00:01:31,460 --> 00:01:32,300
multiple files.

28
00:01:32,300 --> 00:01:34,440
We can do the same thing to get rid of them.

29
00:01:34,520 --> 00:01:35,530
So our AM.

30
00:01:35,540 --> 00:01:38,110
We don't need the services file any more.

31
00:01:38,110 --> 00:01:46,960
Even though it's packed full of useful information and we don't need the master javascript file either.

32
00:01:46,970 --> 00:01:49,500
So go ahead and hit enter and walla.

33
00:01:49,760 --> 00:01:54,120
You see it over here in the Finder that the files have been removed.

34
00:01:54,320 --> 00:01:55,920
That's fantastic.

35
00:01:55,940 --> 00:01:56,470
All right.

36
00:01:56,480 --> 00:01:58,350
So pretty easy stuff right.

37
00:01:58,530 --> 00:02:00,950
Well let's move on to deleting and give.

38
00:02:01,190 --> 00:02:03,990
Getting rid of a directory here.

39
00:02:04,400 --> 00:02:09,250
All right so we've got a services directory which is completely empty.

40
00:02:09,620 --> 00:02:14,670
And then you can see here that we've got this javascript directory which is completely empty.

41
00:02:14,750 --> 00:02:17,450
And what I'm going to do real fast.

42
00:02:17,450 --> 00:02:23,510
Wolmarans services why don't we just throw two files back in here and we're going to use it in a little

43
00:02:23,510 --> 00:02:25,540
bit for another demonstration here.

44
00:02:25,730 --> 00:02:27,390
So touch mange.

45
00:02:27,450 --> 00:02:28,150
Yes.

46
00:02:28,160 --> 00:02:30,850
And then we'll throw in an HTML file or something.

47
00:02:31,160 --> 00:02:32,220
All right cool.

48
00:02:32,270 --> 00:02:36,400
So in our services we now have these two files.

49
00:02:36,710 --> 00:02:40,670
All right so we're going to go back a directory over here.

50
00:02:40,670 --> 00:02:43,630
So we're in our services we're going to step back here.

51
00:02:43,970 --> 00:02:48,480
See the dot dot and we're in our root directory here.

52
00:02:48,800 --> 00:02:53,200
And what I want to do is remove an entire directory.

53
00:02:53,210 --> 00:02:55,790
Now there's actually two ways of doing this.

54
00:02:55,790 --> 00:02:56,890
All right.

55
00:02:57,260 --> 00:03:02,480
Which is set up really smart so you can remove a directory that's empty.

56
00:03:02,840 --> 00:03:03,470
All right.

57
00:03:03,480 --> 00:03:09,890
There's a command for that and there's also a command to remove a directory that is full of files because

58
00:03:10,070 --> 00:03:15,680
how like tragic and ridiculous Would that be if you could remove a directory full of files and you didn't

59
00:03:15,680 --> 00:03:20,940
mean to remove it because it's full of really important stuff and you deleted it and it was gone forever.

60
00:03:21,200 --> 00:03:21,590
All right.

61
00:03:21,590 --> 00:03:27,830
Now one thing that is so important to note that when we're using this remove command in the terminal

62
00:03:28,400 --> 00:03:31,000
your stuff is permanently deleted.

63
00:03:31,010 --> 00:03:31,750
It is new.

64
00:03:31,750 --> 00:03:32,930
It is out of this world.

65
00:03:32,920 --> 00:03:36,770
It might be on a flat earth but it's not on this round earth.

66
00:03:36,770 --> 00:03:37,630
All right.

67
00:03:37,640 --> 00:03:38,840
So it's gone.

68
00:03:38,840 --> 00:03:43,030
It's not like the finder where you delete a file and it appears in your trash can.

69
00:03:43,100 --> 00:03:46,120
Snoots forever remember that burning into your brain.

70
00:03:46,130 --> 00:03:51,650
All right so we're going to learn how to delete a directory that has nothing in it.

71
00:03:51,920 --> 00:03:56,860
So that's going to be this javascript file or folder.

72
00:03:56,870 --> 00:03:58,200
I apologize.

73
00:03:58,220 --> 00:04:03,140
So we're going to use the R M word.

74
00:04:03,350 --> 00:04:07,040
Kind of looks familiar right because we did M-K Derfner for make directory.

75
00:04:07,040 --> 00:04:10,040
Well this is our door for.

76
00:04:10,130 --> 00:04:11,650
Remove directory.

77
00:04:11,750 --> 00:04:19,100
Now I already know this is going to remove this empty javascript directory but I want to I want to show

78
00:04:19,100 --> 00:04:23,400
you the error it's going to give us if we try to remove a directory full of files.

79
00:04:23,420 --> 00:04:30,220
So in this example I'm going to try out services and it says do the directory is not empty.

80
00:04:30,290 --> 00:04:33,710
Meaning I can't use this command there which is great.

81
00:04:33,710 --> 00:04:34,090
All right.

82
00:04:34,100 --> 00:04:35,800
So let's try this again.

83
00:04:35,850 --> 00:04:40,760
R m Dern J S K this is an empty directory.

84
00:04:40,760 --> 00:04:41,870
Boom there it is.

85
00:04:41,870 --> 00:04:42,980
It's gone forever.

86
00:04:42,980 --> 00:04:46,750
There's no way of ever ever getting it back.

87
00:04:46,760 --> 00:04:49,130
All right so pretty easy.

88
00:04:49,280 --> 00:04:54,750
Now let's learn how to remove a directory that is full of files.

89
00:04:54,800 --> 00:05:05,170
So to do that we're going to do r.m der dash capital R K services boum.

90
00:05:05,600 --> 00:05:06,250
All right.

91
00:05:06,400 --> 00:05:10,600
That did not work for us and are checking it out.

92
00:05:10,600 --> 00:05:16,080
I actually use the wrong syntax here so to type this incorrectly.

93
00:05:16,180 --> 00:05:19,930
It would be our m dash capital R.

94
00:05:20,080 --> 00:05:21,280
We don't need the dollar.

95
00:05:21,430 --> 00:05:22,080
All right.

96
00:05:22,120 --> 00:05:24,820
And then services.

97
00:05:24,910 --> 00:05:25,300
All right.

98
00:05:25,300 --> 00:05:30,790
So now this command is going to allow us to delete a directory with files in it.

99
00:05:30,790 --> 00:05:33,830
All right go ahead and press enter and poof.

100
00:05:33,850 --> 00:05:37,820
It's gone it's gone forever so that is it.

101
00:05:37,830 --> 00:05:43,270
That is a wrap for this video we have covered some very important commands in the terminal.

102
00:05:43,300 --> 00:05:49,900
We have learned how to delete files delete directories and the super awesome special command to delete

103
00:05:49,930 --> 00:05:51,860
directories with files in them.

104
00:05:51,880 --> 00:05:53,680
All right let's move on.
