Placeholder Image

字幕列表 影片播放

  • I just wanted to remind you that case to video.

  • So you didn't see one out, Recommend going to video, checking out part one.

  • But if you did see one that will continue on from where we elect and I'll show you how I decided to organize folders with Okay, so now I'm basically come up with the structure for this folder, and I just Googled this, uh, or I Googled the most common file extensions or something like that.

  • And I got this article which just lists a bunch of different file types, and it's pretty good because it's already, like, organized them somewhat at least.

  • So that's actually really good.

  • Yeah, I think I have a bit of work to do it actually keep track of all the different file types, but this is the system that I came up with.

  • So these are the first folders that we have media, other programming and text.

  • We go into media, we have audio images, video, they don't have anything within them.

  • So within these folders is where we're gonna have the year months and all that stuff.

  • And then I came up with programming because a lot of the files that I'm going to use it probably going to be related to programming.

  • So we came up with this one, which is for the different languages, essentially the most common languages that I use.

  • So we have C and C plus Plus, we have a dart.

  • We have daughter base.

  • I think a lot of these folders are probably gonna be empty for a long, long time because a lot of this stuff I don't really use that much.

  • Okay?

  • And then we have text files, and this is gonna be Microsoft That's gonna be related to Excel Word.

  • And then we just have text files, which is just gonna be text files.

  • Essentially.

  • So basically need to go through all of those different file types here and then what we need to do with either create if l statements or cases or something.

  • Um, maybe we can create a dictionary.

  • OK, let me just think about this, and then I'll get back to you and kind of explain how I solved it.

  • All right, so, no, I think the way to solve this problem is too creates a dictionary with all the different extensions and the extensions mapping to the folder where I want to put put them.

  • I mean, this is gonna be a big project.

  • I didn't think this is gonna be that big, but it's it's turning out to be a I thought it was gonna be like a two hour thing, but I think it's gonna be a little bit more than that.

  • So basically, we'll check the different.

  • What the extension is based on the extension will get the destination where we want to put the file and then we'll check within that folder whether that file already exists.

  • S so right now we have This is the Cal folder.

  • So this is the folder that we're tracking or that we're putting things in.

  • And if it's a text file than l check whether that folders empty or has anything in it.

  • So what we can do is we can do this clear, and then we'll run it.

  • Okay?

  • It's now we can create a new text file.

  • So trey, load up text, and then that gets added into our text files folders so it gets added where it should be.

  • And basically, this should then happen for all the different file types that we have, um they should get added into the right subdirectory.

  • But then also within this folder, we should have another folder that says something like 2019 and then within that folder we have the months and all that stuff.

  • So the next thing that we need to do is we need to make sure that it adds a new folder if it's a new year and then goes into that folder and then adds a new month.

  • If it's a new month on, then adds the file into that folder, so that's gonna be the next step.

  • But after that, we are pretty close to where we wanna be.

  • And also, I'm just gonna add Theo extensions for all the different file types.

  • This is just audio.

  • So we have text left.

  • We have we have tons of things left.

  • So, uh, yeah, I'm gonna go go ahead and do that right now all rights and how I've finished this'll list or the dictionary with different file types.

  • And as you can see, there's quite a big list of file types, but this should cover pretty much all of them, and now we just need to add something So that, uh, the file types that don't fit any of these ones still get added to a folder.

  • Yeah, so that's the Oh, okay.

  • So now I think it's sure to work.

  • It seems like it works right now.

  • So, uh, if we just put something random onto the desktop like this one, we don't have a next tension for after effects.

  • So what should happen then?

  • Wait.

  • I need to run at first.

  • So if we run it and then go but this one and put it onto the desktop, it removes it.

  • And since we don't have an extension for after frank fix projects, what it does is it puts it into other, and here it is.

  • Now, if we get A P and J and put it on here, it puts it into media images.

  • And here it is.

  • And let's take this one and put that here too.

  • So that was a python file.

  • It puts that into programming and python.

  • Okay, so that actually works now.

  • It does sort it in the way that we want.

  • Now, the next thing is gonna be thio.

  • Add the dates so we want to create automatically create folders within these folders of the year.

  • So let's be the next time.

  • All right, so now it works.

  • It takes the files and puts them into and like, checks.

  • The extension basically and then goes into the folder corresponding to that extension.

  • And then it checks whether there's already a folder called The Year that is right now 2019.

  • And if it isn't that it creates that folder and then within that folder checks whether there's a month called nine, which is September, so right now.

  • And if it isn't, then it creates one.

  • And if it is, then it goes into that one, and then it puts the file into that folder.

  • So what I've done is I've basically just taken a bunch of files and cluttered down my desk completely s O that we can actually test this properly.

  • So what I'm gonna do is I'm just gonna run the script, and then I'm gonna move one of the files.

  • So essentially modifying the desktop folder, and that should then trigger it.

  • Thio, move all of these files into the desk or into the folder called Cal that you can see right here.

  • I think this is gonna be super satisfying.

  • So, uh, we're gonna run it.

  • We're gonna hope that it works.

  • Uh, Cooley, Right.

  • Let's run it and let's move something.

  • All right?

  • The stuff is completely clean.

  • I mean, look, if that wasn't satisfying for you, then I don't know what ISS Let's go in here.

  • So basically, there was a lot of images.

  • Most of it was images.

  • So we're gonna go into images, and we're gonna see.

  • So it created a folder called 2019.

  • It created a folder for the month, and then it added all of the images into that folder.

  • I mean this.

  • Oh, this is so good.

  • And there was also some video, I think.

  • Yep.

  • Yeah.

  • So fix that too.

  • Um, I think I had some random text files as well.

  • Let's go in here.

  • Yeah.

  • So it did it.

  • Perfect.

  • So this now works.

  • The next thing is gonna be thio make this run in the background constantly.

  • So But what we're gonna do is we're gonna go downstairs.

  • I'm gonna take all of this equipment apart and bring it downstairs, and then we're gonna finish it downstairs, but yeah, this is really cool.

  • All right.

  • So I guess I guess this will be set up now, So let's finish this off and make sure that this program actually runs in the background s so that we don't have to worry about turning it all.

  • All right, So I'm not that familiar with how to make this work.

  • So I'm just gonna google it, and we're gonna try to find out the best way to do it.

  • I know we're probably gonna have to add it to the shell script, but I'm not sure exactly where to add it and how to help to do that.

  • So I'm just gonna google it and then I'll get back to you and kind of explain how it was done.

  • So this this said you do it on Mac.

  • So the way that you do it is you go to launch pad and then you have this other folder.

  • They have something cold water meter and what you do, then it's you open that on.

  • Once you get in here will ask you what you what you want to do, depress application and then on the left hand side Here, you'll have a library.

  • And if you go down to utilities.

  • You can see in this list here.

  • Here we go.

  • Run, shell script.

  • And then you drag that out into year, and they basically type in the commands that you would need to be able to run your script so furtively to go into the right directory.

  • So that iss you, sirs, Uh, how until you get to the root directory.

  • And then after that, you need to run your script.

  • So whatever rescript this so python my wife gone by and that is essentially all that you need to do.

  • And then after you've done this, you can run it and they contested, see if it works, and then you go up here and you press save, and once you press save, you can name it whatever you want.

  • You can add it somewhere.

  • I added the documents, and then once you've saved it, need to go to system preferences.

  • And then you press you sirs and groups.

  • And then there's something called Logan items, and then you basically press plus, and then you can add it.

  • See?

  • So what I did is I had a desk cleaner.

  • Here s so it's already been added And that means that as soon as you run your computer, this thing will run.

  • So right now I'm not running anything.

  • But if we go into documents and ad person not pie to the desktop, it gets removed straightaway.

  • And then if we go into my folder, we can look into programming python 2019 09 and personal pies.

  • So that gets added into the right place at the right time, which is really cool.

  • So now it actually works.

  • We've managed Thio make something that will essentially clean our desktop for us.

  • We don't have to worry about it.

  • We can just put things on to our next stop, and I'll put them into the right folders and directories.

  • Ah, by itself, which I think is really cool.

  • So I'm pretty happy with the outcome of this because trying to keep your desktop clean, it's usually quite difficult, at least for me, because oftentimes I work on things and I just put them on the desktop and then just leave them there, forget that I added them, and then it just keeps piling up.

  • I just add more and more things, but now essentially, this is completely clean off course, you can go way more into depth and, like, get super oh, city about all the different folders which I think would be really interesting to see kind of what different systems you can come up with.

  • But I think this for now.

  • This kind of works well enough for me.

  • Okay, so that's it.

  • We're done.

  • All right, so that's it for this one.

  • I hope you enjoyed it.

  • And I have to say, this is probably my favorite bill that I've done so far.

  • It just feels like it's super useful.

  • So I hope that it gave you some new ideas on things to try to get some inspiration toe, start building something.

  • And also I have to say that I will be starting to stream again starting on Monday on Twitch at 2 p.m. Till three PM So every Monday, Tuesday and Wednesday on the street, me and also I would be offloading Monday stream to YouTube on two states.

  • So on Tuesdays at three pm on YouTube, you can also watch the Monday streets, so this area is gonna be cold building it from scratch.

  • And in this series, we're gonna go through everything literally from an idea to finish after sign front and back and rest 80 eyes.

  • It's gonna be really exciting.

  • And we're gonna build the front and using flutter and then the back end.

  • We're gonna build in flight phone.

  • So I really hope you join me for that this Monday at two.

  • PM on Twitch.

  • Or you can always catch it on Tuesday when I uploaded to you too.

  • Anyway, that's it for this one.

  • I hope I'll see you the next one.

  • Wait.

I just wanted to remind you that case to video.

字幕與單字

單字即點即查 點擊單字可以查詢單字解釋

B1 中級

Python自動化項目。自動清理桌面 (第二部分) (Python Automation Projects: Automatic desktop cleanup (Part 2))

  • 1 1
    林宜悉 發佈於 2021 年 01 月 14 日
影片單字