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