Create a Disk Usage Counter
Learn to create a disk usage counter.
We'll cover the following
This is a simple utility that totals the size of every file in a directory and its sub-directories. It runs on both POSIX/Unix and Windows file systems.
How to do it
This recipe is a utility to report the size of every file in a directory and its sub-directories, along with a total. We'll re-use some of the functions we've used elsewhere in this chapter:
We start with a few convenience aliases:
Get hands-on with 1400+ tech skills courses.