The Challenge: Moving All Image Files to a New Directory
00:00 So you ready for a challenge? This challenge is to move all image files to a new directory.
So when you download the code resources under supporting material, then you can find in there a folder that’s called
practice_files/, and it has a subfolder that’s called
And then the
documents/ directory contains several files and subfolders. And some of them are image files. They are going to have the endings
Once you’ve downloaded this folder, go ahead and inspect it. Click around in there. It should look something like this. So you have the
practice_files/ folder, then a
documents/ subfolder, and then there’s a bunch of stuff in there. And among other things, there are image files. For example, here is
Now your task is to create a new folder in the
practice_files/ folder and call it
images/. And then you want to move all the image files into that folder.
So once you’re done, the new folder should have four files in it, the ones that I just mentioned before and that are listed here on the file again. Of course, your challenge is to do all of this with Python’s
01:17 Here’s a couple of tips to take along on your way.
01:21 Just like before, use code comments to help you get organized. Break out the challenges in smaller tasks, then tackle one task at a time. Look up any documentation if you need help.
You can go to the
pathlib documentation or go back to the course. You also want to test repeatedly to see whether your code actually does what you expect it to do. So that could be using
pathlib, or you can use your graphical user interface to see whether what you expect to happen actually happens. So those are some tips to take along on the way.
01:54 And now again, I will suggest you to stop here and don’t continue with the course. Try to tackle this challenge yourself. See if you can make it to the end, if you can complete it successfully. If you do need help, try a little before you actually go and look up the lessons.
02:12 But then you can always go to the next lesson and then watch me how I would solve this challenge. And keep in mind that that’s just a different way of doing it.
02:20 If you solved it differently, that is completely fine. There’s always many, many different ways that you can tackle a challenge, and comparing your own approach to someone else’s approach can be a helpful way to learn and train your coding skills. So get started.
02:36 Prepare for the challenge and tackle it. And once you’re done, move on to the next lesson and then watch over me solving the challenge.
Become a Member to join the conversation.