Python Basics Exercises: File System Operations (Overview)

In Python Basics: File System Operations, you learned how to use Python to work with files and folders. As a programmer, you’ll use the pathlib and shutil modules to complete file system operations without relying on your graphical user interface (GUI).

While you already got lots of hands-on practice with file system operations, programmers never stop practicing! The more you use your new skills, the more comfortable you’ll be when it’s time to put them to work in your own coding. That’s why it’s a great idea to complete exercises to reinforce and test your knowledge of the file system.

In this video course, you’ll practice:

  • Creating a directory
  • Iterating over the contents of a directory
  • Searching for files using wildcards
  • Moving and deleting files and folders

Along the way, you’ll also get some insight into how to tackle coding challenges in general, which can be a great way to level up as a developer.

This video course is part of the Python Basics series, which accompanies Python Basics: A Practical Introduction to Python 3. You can also check out the other Python Basics courses.

Note that you’ll be using IDLE to interact with Python throughout this course. If you’re just getting started, then you might want to check out Python Basics: Setting Up Python before diving into this course.


Sample Code (.zip)

23.2 KB

Course Slides (.pdf)

3.3 MB

00:00 Welcome to this Real Python course. It’s a Python Basics Exercises course that deals with file system operations. Python Basics Exercises courses are about doing some practical training of writing code and training concepts that you’ve learned in an associated course.

00:20 And I’m going to be writing out those tasks and exercises and solving them while also talking you over what I’m doing and why I’m doing it in a certain way.

00:30 There’s a bit of background for this, so I suggest that you watch the Python Basics File System Operations course that is the associated course to these exercises.

00:39 And if you went through that course, then you should be well equipped to solve these exercises.

00:45 You will learn how to create files and folders, look up contents of a folder, search for files and folders, and also move and delete files and folders. And this is just what these exercises in this exercises course are about as well.

00:59 There’s a tiny other bit of background for this course, which is that I will be using IDLE, the Integrated Development and Learning Environment that comes with Python.

01:08 If you’ve gone through the Python Basics courses, then you’re already familiar with the tool. If not, then you can check it out in these associated courses.

01:17 But if you’re just here to train, you can also just use any Python interpreter or your favorite text editor and solve the exercises using those tools. We’re not going to use any special features of IDLE, so you should be able to tackle it with any sort of text editor. Okay.

01:34 And that’s all about the intro and setup. And if you’re ready to do some hands-on programming, then see you in the next lesson, where I’m going to introduce the exercises to get you warmed up.

Become a Member to join the conversation.