1
00:00:01,460 --> 00:00:03,770
Hey, and welcome back to this video.

2
00:00:04,190 --> 00:00:05,600
So let's continue.

3
00:00:05,780 --> 00:00:11,240
So we have seen how to copy a file from one source to another destination.

4
00:00:11,510 --> 00:00:16,010
Let's quickly see some more ways to copy files and directories.

5
00:00:16,040 --> 00:00:16,580
All right.

6
00:00:16,580 --> 00:00:20,570
So let's quickly create two directories called as one and two.

7
00:00:20,870 --> 00:00:23,190
So we have two directories now.

8
00:00:23,210 --> 00:00:25,660
So let's quickly create two files as well.

9
00:00:25,670 --> 00:00:30,620
So for that, we are going to use the command, which is nano.

10
00:00:32,850 --> 00:00:37,050
Let's call it as file one and hit enter.

11
00:00:37,050 --> 00:00:42,390
And let's say this is file one and let's quickly save it.

12
00:00:42,390 --> 00:00:43,530
Come out of it.

13
00:00:43,590 --> 00:00:45,540
Nano file two.

14
00:00:47,410 --> 00:00:50,650
This is filed to save it.

15
00:00:53,540 --> 00:01:01,340
And we have two folders or directories one and two and two files, which is file one and file two.

16
00:01:01,790 --> 00:01:02,490
Perfect.

17
00:01:02,510 --> 00:01:09,170
So now if I want to copy this file, which is a file one, so I'm going to type the command, CP file

18
00:01:09,170 --> 00:01:13,400
one and copy it to the directory, which is one.

19
00:01:14,300 --> 00:01:19,310
And this should have copied the file into the directory, which is one.

20
00:01:19,490 --> 00:01:21,860
You can also verify using the command three.

21
00:01:21,860 --> 00:01:22,970
So three, one.

22
00:01:22,970 --> 00:01:29,870
And it entered and you can see the tree structure of the directory, which is one.

23
00:01:29,870 --> 00:01:34,410
And there is a file which is a file one inside this directory.

24
00:01:34,430 --> 00:01:35,000
Perfect.

25
00:01:36,500 --> 00:01:38,440
And you can see the output over here as well.

26
00:01:38,450 --> 00:01:42,830
Zero directories and one file inside one folder.

27
00:01:43,040 --> 00:01:43,610
Okay.

28
00:01:43,760 --> 00:01:48,320
So now let's say I want to copy this directory.

29
00:01:48,320 --> 00:01:51,200
So let's say copy the directory to.

30
00:01:51,200 --> 00:01:58,370
So before copying the directory, let's copy the file to as well into the directory which is two and

31
00:01:58,370 --> 00:02:04,760
hit enter and let's type the command three two and see if there is a file and yes, there is a file.

32
00:02:04,790 --> 00:02:10,640
So let me type the command tree over here and you can see there is a directory one which has a file

33
00:02:10,640 --> 00:02:17,180
one there is a directory two which has a file two and here we have two files as well, which is file

34
00:02:17,180 --> 00:02:18,410
one and file two.

35
00:02:18,500 --> 00:02:19,100
Great.

36
00:02:19,250 --> 00:02:21,860
Let me clear the screen for you now.

37
00:02:22,910 --> 00:02:27,500
Let's say I want to copy the directory, which is two inside the directory one.

38
00:02:27,500 --> 00:02:30,230
So this time I do not want to copy a file.

39
00:02:30,260 --> 00:02:33,170
Instead I want to copy a directory for that.

40
00:02:33,170 --> 00:02:35,090
I'm going to use the command CP.

41
00:02:35,270 --> 00:02:38,630
So let's say copy two to copy one and hit enter.

42
00:02:38,630 --> 00:02:42,050
And here you can see we got an error.

43
00:02:42,170 --> 00:02:47,450
It says you are trying to copy a directory and not specify it hyphen.

44
00:02:47,450 --> 00:02:50,000
Ah, so omitting the directory.

45
00:02:50,240 --> 00:02:56,150
Now here, if you want to copy a directory you have to specify hyphen.

46
00:02:56,150 --> 00:03:01,070
Ah then and only then you will be able to copy those directories.

47
00:03:01,070 --> 00:03:06,890
And now when I hit enter, let's go inside one and see.

48
00:03:06,890 --> 00:03:14,240
Or else we can also use the command tree and you can see inside the directory of one we have a directory

49
00:03:14,240 --> 00:03:20,990
which is two which contains a file two and yes we already copy the file one inside the directory, one

50
00:03:20,990 --> 00:03:22,580
which is already present.

51
00:03:22,940 --> 00:03:27,550
Let's go inside one and see as well the same structure.

52
00:03:27,560 --> 00:03:33,860
There is a file one and there is a new directory which has been copied over here, which is two.

53
00:03:33,890 --> 00:03:41,690
If we go inside to and hit enter and see here, we can find the file which is file two, which is exactly

54
00:03:41,690 --> 00:03:43,820
the same structure that we see over here.

55
00:03:44,270 --> 00:03:51,320
So I hope you guys understood how you can copy directories recursively inside another, directories

56
00:03:51,320 --> 00:03:54,130
from one source to another destination.

57
00:03:54,140 --> 00:04:00,650
This is very, very handy and people many times make these mistakes while copying directories, which

58
00:04:00,650 --> 00:04:02,570
you should always keep in mind.

59
00:04:02,750 --> 00:04:04,160
I hope you guys understood.

60
00:04:04,190 --> 00:04:04,910
Thank you.
