What is taking up the space on your hard disk? TreeMap it!

Several years ago, I saw a presentation from Microsoft Research about online communication in communities . In particular, a group was studying online communities based on NewsGroup message traffic volume. One of the results was a graphical view of the newsgroups called Netscan.

I didn’t think much of it til I received a comment on my blog Running out of space ? What's on your disk? in which I showed some code to put into a table the folders and their sizes on your hard disk. The comment pointed to a web site showing a Treemap to display disk space usage.

So, it was fairly easy to make a program that shows a map of my hard disk in a treemap. This is a sample treemap of my “c:\Program Files\” folder.


The treemap shows rectangles for each folder. Each rectangle is divided alternately horizontally or vertically, into subrectangles for each subfolder proportional in size to the folder. Hovering the mouse over a rectangle shows the folder path and size in a tooltip. The leftmost large block that takes the entire height shows that almost 1/3rd  is taken up by Visual Studio 2003. The top left light blue large block is “Visual Studio 2003\vc7\atlmfc\lib” The next large vertical band is “Program Files\Common Files” with a couple speech engines and the one after is “Program Files\Microsoft Office”

A folder can contain files and folders. If a folder contains 5 subfolders and 10 files, it will have 6 subrectangles: 1 for each subfolder and 1 for the files (labeled with “*\” at the end)

Each folder is a MyRect object subclassed from Shape and added to the form, so there could be thousands of objects.

Try clicking on a folder: the MyRect Click event creates a new instance of the form drilling down one level deeper into that Rectangle.

The code to generate the Treemap (about 100 lines)  in HTML is here and the raw prg is here. You can modify the code to add features delete folders that are right clicked on, use colors to show last used dates, show folder names on the rectangles, etc.



(Thanks to John Koziol for feedback on this code)




Comments (21)
  1. senkwe says:

    hmm, not sure what to do with the .PRG file

  2. Steven Holt says:

    I’m getting an error messasge running this that I suspect is related to the method of parameter passage that is not backwards compatile to the visual version I’m using. What version is it written for?

    PROCEDURE init(cPath as String, fSubDir as Boolean)

    Error location

    _tooltiptimeout=0 && don’t timeout til user moves mouse

  3. Calvin_Hsia says:

    PRG is a program file that requires Visual Foxpro.

    I am always using the latest version of Visual Foxpro, and may use some features (i.e. _tooltipTimout) that aren’t available in earlier versions. You’re welcome to remove newer features from the code. It’s just simple code that should run in older versions.

  4. Great post Calvin and it works nicely!

    Thank you

  5. Jeff Pace says:

    Cool. Reminds me of one of those Peter Max black light posters in the sixties.

  6. Wow…. I just had a nightmare of a time using a computer.


    A colleague asked me if I could do…

  7. In this post I published 100 lines of code that showed how to get a visual representation of your hard…

  8. Daw Tsering says:

    Calvin, it works great!

    If you add a

    MDIForm = .t.

    ScrollBars = 3

    Then I can maximum size of the screen and see all the shapes.

  9. RichS says:

    If you want a full ( free ) app, then try "windirstat".

  10. Lutz says:

    I think SequoiaView is a tad nicer. has been available since years.


  11. I was running really low on disk space on one of my machines, so I ran my Treemap utility on it (see…

  12. ... says:

    Ich erklare meinen Freunden uber diese Seite. Interessieren!

  13. ... says:

    Stupore! Amo questo luogo!:)))))))

  14. ... says:

    Stupore! Amo questo luogo!:)))))))

  15. Sometimes friends or relatives might hear that you’re an expert with using computers, and might ask you

  16. On one of my Vista machines, I have a 140G hard drive partitioned into C (20g), D (80G) and E (40g).

  17. On one of my Vista machines, I have a 140G hard drive partitioned into C (20g), D (80G) and E (40g).

  18. I was running out of disk space on one of my machines, so I used my TreeMap program to see where I could

  19. I was running out of disk space on one of my machines, so I used my TreeMap program to see where I could

  20. garry-rv says:

    <a href= http://kakueei.angelfire.com >boat and retail whole sales</a> <a href= http://kosaaea.angelfire.com >beverly kirk and wjla</a> <a href= http://neffehc.angelfire.com >2006 ohio state football schedule</a> <a href= http://sphqgio.angelfire.com >breast lift dangers</a> <a href= http://lodibti.angelfire.com >americanidol poll</a>

Comments are closed.

Skip to main content