1
00:00:07,480 --> 00:00:13,840
What is everybody this is Jason with there's soapstar calm and in this video we are going to learn how

2
00:00:13,840 --> 00:00:19,190
to move files copy files and rename files.

3
00:00:19,420 --> 00:00:22,290
All right so let's dive in and get started.

4
00:00:22,480 --> 00:00:24,190
So we've been working in our terminal.

5
00:00:24,190 --> 00:00:28,670
We've got a few commands we've done in here so let's go ahead and clear this out.

6
00:00:28,840 --> 00:00:30,240
So again I'm just going to write.

7
00:00:30,240 --> 00:00:35,140
Clear and press ENTER give us more space to work with.

8
00:00:35,140 --> 00:00:40,140
All right so what we're going to learn first is how to move files.

9
00:00:40,360 --> 00:00:45,240
So in the Finder what I'm gonna do is I'm going to go back a directory.

10
00:00:45,250 --> 00:00:52,960
I'm going to go back one more and actually let's go ahead and stay in the directory fun that we've done

11
00:00:52,960 --> 00:00:53,400
here.

12
00:00:53,590 --> 00:01:01,420
So from the from the root level of our directory fun let's go ahead and create a folder so you can see

13
00:01:01,420 --> 00:01:03,920
here in the terminal that I'm in services.

14
00:01:03,920 --> 00:01:04,230
All right.

15
00:01:04,240 --> 00:01:11,950
So I need to go back a level and now I'm in the root level of this project that we're working in right

16
00:01:11,960 --> 00:01:12,810
listed all out.

17
00:01:12,850 --> 00:01:20,350
Everything looks good so let's create a folder and I'm going to call this.

18
00:01:20,600 --> 00:01:26,440
So let's just make a directory and we'll call it J us say that we want to store over javascript files

19
00:01:26,440 --> 00:01:26,880
in here.

20
00:01:27,070 --> 00:01:34,160
So I've just made this directory and you can see over here in the Finder that it's appeared and says

21
00:01:34,210 --> 00:01:39,760
I'm building this project I want to organize a project a little bit better and I want to keep all my

22
00:01:39,760 --> 00:01:45,940
javascript files in this one directory so we can do that through the terminal by moving the file.

23
00:01:45,940 --> 00:01:49,860
And to do that we're going to type in the command and we move.

24
00:01:50,070 --> 00:01:50,740
All right.

25
00:01:50,740 --> 00:01:54,490
And then we need to grab the name of the file that we want to move.

26
00:01:54,490 --> 00:01:55,740
So we're going to type in main.

27
00:01:55,780 --> 00:02:01,020
J.S. and then now we've got to give it a location of where we want it to go.

28
00:02:01,180 --> 00:02:06,820
If I was to go ahead and press enter here the terminal is going to throw me in there and it says hey

29
00:02:06,820 --> 00:02:10,410
dude you didn't give me a directory where you want me to move this.

30
00:02:10,570 --> 00:02:12,700
So please specify something for me.

31
00:02:12,700 --> 00:02:13,650
So let's do it again.

32
00:02:13,660 --> 00:02:16,370
Let's take an NBC main.

33
00:02:16,440 --> 00:02:17,490
Yes.

34
00:02:17,590 --> 00:02:20,610
And where we want to move this is into our James folder.

35
00:02:21,010 --> 00:02:27,820
All right go ahead and press enter and you can see over here in the Finder that the file has disappeared

36
00:02:27,820 --> 00:02:28,380
it's gone.

37
00:02:28,390 --> 00:02:29,280
Where did it go.

38
00:02:29,410 --> 00:02:32,120
Well we moved it into the javascript file.

39
00:02:32,130 --> 00:02:33,190
So pretty cool.

40
00:02:33,190 --> 00:02:34,050
There it is.

41
00:02:34,330 --> 00:02:34,800
All right.

42
00:02:34,810 --> 00:02:39,400
And then we can move files around anywhere we want.

43
00:02:39,460 --> 00:02:45,980
And what I want to show you now is how to move a file back to where it was and we can do this.

44
00:02:46,090 --> 00:02:48,040
This is a little bit tricky.

45
00:02:48,130 --> 00:02:55,570
Make sure that we're in the JS file so we've got to change our directory so CD J us listening out we

46
00:02:55,570 --> 00:03:02,710
can see our file in here and we're going to do them in the main dot J S file.

47
00:03:03,040 --> 00:03:09,700
And what we have to do is we need to go back a directory so remember how we use the CD command space

48
00:03:09,780 --> 00:03:10,760
dot dot.

49
00:03:11,110 --> 00:03:15,760
Well we're going to do the same thing the DOT DOT allows us to go back a level.

50
00:03:15,760 --> 00:03:18,790
So I'm going to hit dot dot for Slash.

51
00:03:18,790 --> 00:03:27,130
This is going to give me the path where I want to go and where we want to go is directory fun.

52
00:03:27,240 --> 00:03:33,280
So in the terminal Let's go ahead and type that out directory fun.

53
00:03:33,280 --> 00:03:36,170
So we're going to take this file and we're going to move it back.

54
00:03:36,190 --> 00:03:36,850
All right.

55
00:03:36,880 --> 00:03:40,460
It looks like we have something really goofy happen here.

56
00:03:40,630 --> 00:03:51,110
So we didn't even move our main japes file into our directory fun directory.

57
00:03:51,160 --> 00:03:57,840
What it actually did is it created a directory fun file without an extension.

58
00:03:58,000 --> 00:04:05,520
And the reason it did this is because you can actually use this same command M.V. to rename a file.

59
00:04:05,530 --> 00:04:13,330
So technically what I said here is I said hey in the javascript directory and take the main js file

60
00:04:13,620 --> 00:04:17,600
move it back a directory and rename it to directory fun.

61
00:04:17,740 --> 00:04:25,000
So that's what happened here so let me show you how to actually properly do this so we're in our javascript

62
00:04:25,090 --> 00:04:27,000
our JS directory still.

63
00:04:27,010 --> 00:04:28,630
So let me come back to here.

64
00:04:28,900 --> 00:04:34,010
I'm going to create the file again maynt genius.

65
00:04:34,030 --> 00:04:35,170
All right so now it's here.

66
00:04:35,170 --> 00:04:36,690
So let's try this again.

67
00:04:36,970 --> 00:04:40,470
We're going to do nvm main Dot.

68
00:04:40,500 --> 00:04:45,070
Yes and we're simply going to do that dot dot for Slash.

69
00:04:45,070 --> 00:04:51,270
We're just going to leave it at that because that way it puts it into the Directory fun here.

70
00:04:51,700 --> 00:04:59,110
So now when we come back over to our directory now you'll see the file is here.

71
00:04:59,110 --> 00:05:06,350
Now let me explain a little bit further why it created this file here in the jail.

72
00:05:06,370 --> 00:05:12,160
I'm going to quickly find another file we'll just call this awesome dot Jess.

73
00:05:12,300 --> 00:05:19,320
All right what I was saying and this command is well what I was trying to say is move this file back

74
00:05:20,340 --> 00:05:23,850
into a directory which technically didn't exist.

75
00:05:23,850 --> 00:05:29,840
So a directory that does exist is this services in our directory bun.

76
00:05:29,880 --> 00:05:43,140
So what I could do with this is I could say move the awesome dot J us back a directory into the services

77
00:05:43,320 --> 00:05:44,260
directory.

78
00:05:44,400 --> 00:05:49,960
And if I hit enter you can see that the file isn't in here anymore.

79
00:05:50,130 --> 00:05:55,860
If we go into our services you can see that the awesome jazz file has now been moved.

80
00:05:55,860 --> 00:05:57,630
So pretty cool stuff here.

81
00:05:57,660 --> 00:06:01,110
So we've covered how to move a file.

82
00:06:01,140 --> 00:06:03,690
Let me show you how to copy a file.

83
00:06:03,690 --> 00:06:06,280
So let's find a file that we want to copy here.

84
00:06:06,660 --> 00:06:09,470
Let's say that this.

85
00:06:09,680 --> 00:06:11,600
Let's see we have here.

86
00:06:11,610 --> 00:06:13,700
Let's create another folder or another file.

87
00:06:13,710 --> 00:06:21,450
So let's go back a level where in our directory fun we're going to create a file called Master dodgiest

88
00:06:22,050 --> 00:06:29,450
and say this is a master template of some specific crazy function in our code project whatever.

89
00:06:29,550 --> 00:06:30,260
Right.

90
00:06:30,300 --> 00:06:36,090
So what we want to do is say we want to use this template in other parts of our project.

91
00:06:36,120 --> 00:06:38,580
OK like another component per se.

92
00:06:38,880 --> 00:06:44,550
And we're going to move it over into our services so or copy it into our services because we want it

93
00:06:44,550 --> 00:06:48,530
to also stay in this root level directory fun.

94
00:06:48,750 --> 00:06:57,330
So we're going to use the command C.P. to copy and then we're going to grab the name of the file master

95
00:06:57,890 --> 00:07:04,740
dot J J.S. and then we're going to specify the directory we wanted to go into which will just in this

96
00:07:04,740 --> 00:07:08,810
example call it services and we're going to hit enter.

97
00:07:08,910 --> 00:07:16,110
Now if we come into our services you will see that we have the master js file and this is this is cool

98
00:07:16,140 --> 00:07:24,360
because when you're working with different frameworks like angular to for example you're working with

99
00:07:24,360 --> 00:07:30,990
a lot of components you might have a typescript file that might be some master like template for a component

100
00:07:30,990 --> 00:07:37,560
per se and you could go ahead and use this copy command to copy the entire file into that component

101
00:07:37,860 --> 00:07:40,350
to set up like us a skeleton for you.

102
00:07:40,350 --> 00:07:40,680
All right.

103
00:07:40,680 --> 00:07:42,760
So pretty easy stuff.

104
00:07:42,780 --> 00:07:49,160
Now the last thing that I want to cover is how to rename a file.

105
00:07:49,380 --> 00:07:52,390
Let's say this awesome japes file here.

106
00:07:52,560 --> 00:07:57,660
Very poorly named it doesn't really specify anything that we're trying to do.

107
00:07:57,660 --> 00:08:00,200
So let's go ahead and change the name of that.

108
00:08:00,420 --> 00:08:04,450
So paying attention in our terminal we're in the directory fun.

109
00:08:04,560 --> 00:08:06,820
So we need to get into our services.

110
00:08:07,260 --> 00:08:13,470
So we're going to change the directory here and to rename a file We're going to use the same.

111
00:08:13,500 --> 00:08:16,250
And the command that we use for move.

112
00:08:16,680 --> 00:08:19,260
And then we're going to say we want to take the file.

113
00:08:19,260 --> 00:08:27,250
Awesome J.S. and let's rename it to cats just because that makes way more sense.

114
00:08:27,690 --> 00:08:29,020
All right.

115
00:08:29,100 --> 00:08:32,060
And you can see the file has change right before our eyes.

116
00:08:32,100 --> 00:08:33,660
So very powerful stuff.

117
00:08:33,660 --> 00:08:36,300
Again this is stuff that you're going to be using all the time.

118
00:08:36,330 --> 00:08:43,290
You've got to know how to move files around copy things around and also rename things in case you need

119
00:08:43,290 --> 00:08:48,730
a better naming convention for some of the files you're working with so that is a wrap for this video.

120
00:08:48,870 --> 00:08:49,760
Let's move on.
