1 00:00:00,590 --> 00:00:03,410 By directory and file management. 2 00:00:05,310 --> 00:00:09,720 Is there a large number of files to handle in your Biton program? 3 00:00:10,170 --> 00:00:17,250 We can arrange our code within different directories to make things more manageable and reachable. 4 00:00:17,940 --> 00:00:24,570 A directory or folder is a collection of our set of files and sub directory. 5 00:00:24,600 --> 00:00:29,730 So we know that whenever you are having multiple files to handle in some python applications, we can 6 00:00:29,730 --> 00:00:35,430 divide those files into multiple directories according to the file size or the purpose of the file. 7 00:00:35,940 --> 00:00:42,420 And we know that the directory is nothing but one file system which can hold other files or subdirectories. 8 00:00:42,840 --> 00:00:50,430 Python has the W model, which provides us with many useful methods to work with the directories and 9 00:00:50,430 --> 00:00:51,810 the files as well. 10 00:00:51,870 --> 00:00:53,700 So that is one model called with. 11 00:00:53,910 --> 00:00:59,950 So we are suppose to write here import ways at the beginning of the code and then we can go for ways 12 00:00:59,970 --> 00:01:02,910 dot different methods defined in the respective model. 13 00:01:03,600 --> 00:01:10,410 So directory management in Python means creating a directory, renaming it, listing all the directories 14 00:01:10,410 --> 00:01:12,150 and working with them. 15 00:01:12,390 --> 00:01:18,540 So creating a directory, listing a directory, maybe reviewing a directory, renaming a directory can 16 00:01:18,540 --> 00:01:22,560 be done using this directory management library functions. 17 00:01:22,800 --> 00:01:28,590 So let us go for one demonstration, for the easy understanding to show you that how this file and directory 18 00:01:28,590 --> 00:01:36,060 management can be done in our Python applications to do some operations on the file and directory is 19 00:01:36,060 --> 00:01:37,710 what importing the model that is? 20 00:01:37,790 --> 00:01:38,240 Oh yes. 21 00:01:38,640 --> 00:01:41,680 So we operate in import with at first of methode. 22 00:01:41,680 --> 00:01:45,840 We are going to initiate and do execute is get C W.D.. 23 00:01:46,380 --> 00:01:52,890 There is a current working directory, so it returns the present working directory in which we are now 24 00:01:53,010 --> 00:01:59,010 existing and then we'll print with get current working directory in the bite. 25 00:01:59,370 --> 00:02:03,360 That means returns of prison working directory as a byte object. 26 00:02:03,780 --> 00:02:05,170 So let us go for the execution. 27 00:02:05,190 --> 00:02:05,940 You can see that. 28 00:02:06,450 --> 00:02:10,680 So at first it is telling that we are existing in this particular current directory. 29 00:02:10,710 --> 00:02:14,300 So ready in this particular Guardian directory that is equal on users or not. 30 00:02:15,090 --> 00:02:23,010 I know if I want to execute this method that is a get C, W, D, B, then it is showing me that it 31 00:02:23,010 --> 00:02:28,290 is the current working directory and it is it will be returned as a byte object. 32 00:02:29,010 --> 00:02:32,730 So now let us go for one change directory here. 33 00:02:33,150 --> 00:02:36,080 So here you see we are actually in this particular calendrical. 34 00:02:36,430 --> 00:02:37,590 That is user or not. 35 00:02:38,250 --> 00:02:41,420 Now from this, we are trying to go to the directory. 36 00:02:41,430 --> 00:02:42,630 That is a file test. 37 00:02:42,990 --> 00:02:45,180 So our part will be something like this. 38 00:02:45,510 --> 00:02:48,330 So now let let us go for the execution here. 39 00:02:48,630 --> 00:02:51,660 So sequel on users or no file test. 40 00:02:52,080 --> 00:02:53,670 So that is of a change directory. 41 00:02:53,700 --> 00:02:58,530 That method is C desire, which will be used to change the current directory. 42 00:02:58,950 --> 00:03:00,850 And we are going to insert it. 43 00:03:00,850 --> 00:03:04,110 We we're going to go into this file test folder. 44 00:03:04,500 --> 00:03:10,110 So now if I go for this and then we are going for this list directory, that means all files and subdirectories 45 00:03:10,110 --> 00:03:14,310 inside the directory can be known using the least dard method. 46 00:03:14,550 --> 00:03:15,720 So we are executing this. 47 00:03:16,320 --> 00:03:21,970 So you see, we are getting this list of files or three files on Banda's and one test dot text. 48 00:03:22,320 --> 00:03:23,460 So let us check. 49 00:03:23,820 --> 00:03:27,330 Yes, we are having three files on Sundays and then one is dark BSD. 50 00:03:27,870 --> 00:03:30,290 So to get this list, what, using this method. 51 00:03:30,360 --> 00:03:31,610 That is a list dark. 52 00:03:32,500 --> 00:03:32,690 OK. 53 00:03:32,880 --> 00:03:35,670 So we have gone for this particular folder. 54 00:03:35,700 --> 00:03:36,960 We are now in this particular folder. 55 00:03:36,990 --> 00:03:40,140 So now if I bring this one, it will bring that in. 56 00:03:40,140 --> 00:03:40,770 Which folder. 57 00:03:40,830 --> 00:03:43,110 We are actually belonging at this moment. 58 00:03:45,110 --> 00:03:49,610 So if I execute, we can find that one in this particular folder right at this moment. 59 00:03:50,720 --> 00:03:50,910 OK. 60 00:03:51,070 --> 00:03:55,040 Now we shall make a new directory that is a test. 61 00:03:55,460 --> 00:03:57,790 So the method is aimed at desire. 62 00:03:57,850 --> 00:04:02,480 That is make directory used to make a new directory under the present directory. 63 00:04:02,840 --> 00:04:04,880 So the test will be will be created. 64 00:04:04,940 --> 00:04:05,870 So you'll see that is. 65 00:04:05,870 --> 00:04:06,050 No. 66 00:04:06,050 --> 00:04:08,450 A distance of any test folder here. 67 00:04:09,080 --> 00:04:11,240 So let s go for execution of the same. 68 00:04:12,020 --> 00:04:14,080 So we are supposed to get one test folder in. 69 00:04:14,090 --> 00:04:17,210 The folder is empty, but the folder has got created. 70 00:04:18,140 --> 00:04:21,410 Next we are going for use to rename a directory. 71 00:04:21,440 --> 00:04:27,230 So now we are going to use the method that is the rhenium which will rename this test folder to this 72 00:04:27,320 --> 00:04:28,520 new one. 73 00:04:28,790 --> 00:04:29,480 New one. 74 00:04:29,510 --> 00:04:31,550 There is another for Lenine we are going to give. 75 00:04:31,880 --> 00:04:37,730 So now let us go for the execution and you can find that the test folder has got the name to the new 76 00:04:37,730 --> 00:04:39,320 one here and the folder is empty. 77 00:04:41,350 --> 00:04:41,560 OK. 78 00:04:41,680 --> 00:04:44,050 Now removing a file and a directory. 79 00:04:44,080 --> 00:04:46,780 So how to remove a file and how to remove one directory? 80 00:04:47,170 --> 00:04:50,740 So here you are moving this dark tsd and new one folder. 81 00:04:51,100 --> 00:04:57,580 So the respective methods are remove, remove will be used to remove one file and Artim desired method 82 00:04:57,580 --> 00:04:59,770 will be used to remove our directory here. 83 00:05:00,100 --> 00:05:01,930 So let's go for the execution of the same. 84 00:05:02,230 --> 00:05:03,630 So we have executed this one. 85 00:05:03,640 --> 00:05:05,710 So Tess Dot, DSD, a new one. 86 00:05:06,280 --> 00:05:12,830 You can find that they are not existing at this moment because we have executed these two calls. 87 00:05:13,210 --> 00:05:16,330 So now we going we are going to change two of our directory. 88 00:05:16,360 --> 00:05:19,490 There is a pendant, one we went to under this particular file. 89 00:05:19,520 --> 00:05:20,830 That's not when you are coming out. 90 00:05:21,100 --> 00:05:25,410 So, again, we're using the method that is a C HDR. 91 00:05:25,810 --> 00:05:30,910 So again, we shall come back to my to my siecle on users or no folder. 92 00:05:31,360 --> 00:05:37,390 So in this particular demonstration, we have shown you that how to operate with the file, how to deleted 93 00:05:37,780 --> 00:05:39,670 and how to rename one folder. 94 00:05:39,700 --> 00:05:41,680 How to create one folder and so on. 95 00:05:42,010 --> 00:05:48,610 And how to see that in which got into working directory directly where belonging and other different 96 00:05:48,610 --> 00:05:50,680 issues in the proper demonstration. 97 00:05:50,920 --> 00:05:54,580 And you see right at this woman, we're not having any folder here. 98 00:05:54,820 --> 00:05:56,260 Not that this dot dxp. 99 00:05:56,470 --> 00:05:59,020 So they have got removed and they have got delivered. 100 00:05:59,650 --> 00:06:00,910 Thanks for watching this video.