From the course: Python Essential Libraries

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Challenge: PyFilesystem

Challenge: PyFilesystem - Python Tutorial

From the course: Python Essential Libraries

Start my 1-month free trial

Challenge: PyFilesystem

(upbeat music) - [Instructor] Okay, it's time for another programming challenge. So let's take what we learned in this chapter about working with Py File system and put it to use. So here's the challenge. How would use this library to calculate the total size of all the text files contained within a given directory including all of the subdirectories? So if you look at the file examples folder, you'll notice that there are a few different file types within here. So we have some text files, right, we've got some RTF files. There's a couple of Word docs in here. So what I'm going to do is run the finished version of the challenge to show you what the output should look like. So let me go over to my terminal and I'm going to go ahead and run this. And you can see that when I run this, the result there is that all of the text files take up 1,476 bytes of space. So, take a few moments, think about how you might solve this…

Contents