© Moritz Lenz 2017

Moritz Lenz, Perl 6 Fundamentals , https://doi.org/10.1007/978-1-4842-2899-9_10

10. A File and Directory Usage Graph

Moritz Lenz

(1)Fürth, Bayern, Germany

You bought a shiny new 2TB disk just a short while ago and you’re already getting low disk space warnings. What’s taking up all that space?

To answer this question, and experiment a bit with data visualization, let’s write a small tool that visualizes which files use up how much disk space. We also get to explore some functional programming concepts in the process.

10.1 Reading File Sizes

To visualize file usage, we must first recursively read all directories and files in a given directory, and record their sizes. To get a listing of all elements in a directory , we can use the ...

Get Perl 6 Fundamentals : A Primer with Examples, Projects, and Case Studies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.