1
00:00:00,300 --> 00:00:06,689
In this video, I'll explain you the solution I came up with to rename all these files.

2
00:00:07,830 --> 00:00:13,710
So the goal here was to add the date time when the file was created for each file.

3
00:00:14,280 --> 00:00:20,370
Now to understand this codes, you first need to watch the previous video where I explained how you

4
00:00:20,370 --> 00:00:24,270
can get the deets one of five was created.

5
00:00:24,510 --> 00:00:27,870
So please watch that video if you didn't do so already.

6
00:00:28,200 --> 00:00:29,130
And this is a code.

7
00:00:29,130 --> 00:00:35,280
So I imports path import date time from the time and then create a root directory.

8
00:00:35,280 --> 00:00:38,790
Path objects, so files.

9
00:00:39,150 --> 00:00:41,580
So now we can work on files.

10
00:00:41,580 --> 00:00:47,650
We can get all the items inside files, which is December November.

11
00:00:47,670 --> 00:00:53,160
Also, text files and if the item is a file, so we check if it's a file.

12
00:00:53,790 --> 00:00:54,950
We do these.

13
00:00:54,960 --> 00:00:56,610
If not, we don't do anything.

14
00:00:56,610 --> 00:00:58,620
So if it's not the file, we don't do anything.

15
00:00:58,620 --> 00:01:04,700
If it's in a folder and created it is this one here.

16
00:01:04,709 --> 00:01:12,810
So what we do is we first get different stats about the file data size, et cetera.

17
00:01:12,810 --> 00:01:17,900
But we extract only the time when the file was created with this property.

18
00:01:17,910 --> 00:01:26,850
So that gives us the sequence from 1st of January 1970, and then we convert that into a real data time

19
00:01:26,970 --> 00:01:30,330
human readable datetime year month sequence and so on.

20
00:01:30,480 --> 00:01:39,180
We convert that date time object then into a string, and then the new file name is that string, plus

21
00:01:39,180 --> 00:01:46,500
an underscore plus path that's name father's name is A, B, C and so on.

22
00:01:46,830 --> 00:01:48,890
And the path object.

23
00:01:48,900 --> 00:01:55,770
Then as usual, we have that only name that's so not so hot, not so easy.

24
00:01:56,130 --> 00:01:58,260
I hope you share the same opinion with me.

25
00:01:58,710 --> 00:02:00,900
And so let's move on with more videos to.

