What’s the Size?

You are working as an IT consultant for a big firm. They have a lot of documents and files stored on their server. However, they are running out of storage and need to perform an audit on their files to better understand where most of their storage is being used. They want a Python program that takes a directory path as input, goes through every file and subdirectory in that directory, calculates the size of each file (in bytes), sums them up, and returns the total size of files in that directory.
The only line of the input will be a string that represents the path to a directory on the server.
The output of the program should be a single number which is the total size of all files, in bytes, found in that directory and its subdirectories.
Input
Output
documents
24
Note: You can search online on how to get the size of a file using pathlib.
 

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue