1
00:00:00,060 --> 00:00:01,710
Time for another exercise.

2
00:00:01,980 --> 00:00:09,240
Your task for this exercise is to write a script which searches through directories and subdirectories

3
00:00:09,240 --> 00:00:14,970
for a file given a search term, for example.

4
00:00:15,910 --> 00:00:18,640
Let's see, the search term is 14.

5
00:00:18,850 --> 00:00:20,050
The number 14.

6
00:00:20,710 --> 00:00:26,650
So you want to find all the files which have 14 in their names in the file name.

7
00:00:27,160 --> 00:00:33,760
And here I have is this information nation directory and to other directories with these file names.

8
00:00:35,130 --> 00:00:42,690
So you want the script to search the destination directory and find any files that could be in that

9
00:00:42,690 --> 00:00:49,920
directory or in the subdirectories of the destination directory, such as items one items two.

10
00:00:50,280 --> 00:00:58,560
In our case, we have two files that have 14 in their file names, so 14 here and also this file name,

11
00:00:58,560 --> 00:01:01,170
another 14, 14 14.

12
00:01:01,470 --> 00:01:06,420
The output of the scripts should be looking like this here.

13
00:01:06,630 --> 00:01:16,020
So we have two absolute paths pointing to each of the files that were found with that search term in

14
00:01:16,020 --> 00:01:16,860
the file name.

15
00:01:17,430 --> 00:01:24,720
Now, you haven't yet learned how to get the absolute path of a file, so I can teach you that right

16
00:01:24,720 --> 00:01:27,870
now from path live import path.

17
00:01:28,410 --> 00:01:38,910
And if you have a path object pointing to a file such as Destination Item one 10, they'll see us v,

18
00:01:38,910 --> 00:01:39,570
for example.

19
00:01:40,710 --> 00:01:44,370
And then if you do print path, that's absolute.

20
00:01:44,910 --> 00:01:47,220
That's a method that will give you.

21
00:01:48,520 --> 00:01:56,380
The absolute path of that particular file tendency is the absolute path is that the relative path to

22
00:01:56,380 --> 00:02:03,160
loss, the direct to race where these routes directory is located in the computer.

23
00:02:03,310 --> 00:02:10,180
So this is a Linux computer and it's usually starts from slash home slash, another folder, slash another

24
00:02:10,180 --> 00:02:11,470
folder and so on.

25
00:02:12,390 --> 00:02:18,720
On windows, it could be something like see, colon slash and then a range of folders.

26
00:02:19,110 --> 00:02:22,470
So we that's you ready to complete this exercise?

27
00:02:22,770 --> 00:02:24,510
I'll give you the solution in the next video.

