Find the top 10 directories on your system that has the most files in it. For that, only count the files immediately under it. That is, don’t count files in subdirectories. For file, I mean just about anything that isn’t a symbolic link or weird device. Think about how you want to show the person running your program what it’s doing.
This challenge isn’t about counting so much as traversing, remembering, and displaying. How do you know what you need to handle next and which one was largest?
I’m actually writing my own version of this right now because I’m making some benchmarks on
glob and need some test cases. I could just create some new directories and make a bunch of fake files in them, but that’s no fun.
I don’t care how long your program takes, although you might. Let it run in a window (or screen) on its own. Test it on a small directory first (so, there’s a hint there).
I made a Curses version (but don’t look at it until you’ve tried your own solution!):