Partager via


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)

67877

Comments

  • Anonymous
    June 17, 2005
    hmm, not sure what to do with the .PRG file

  • Anonymous
    June 17, 2005
    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

  • Anonymous
    June 17, 2005
    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.

  • Anonymous
    June 19, 2005
    Great post Calvin and it works nicely!

    Thank you

  • Anonymous
    June 20, 2005
    Cool. Reminds me of one of those Peter Max black light posters in the sixties.

  • Anonymous
    June 24, 2005
    Wow…. I just had a nightmare of a time using a computer.
     
    A colleague asked me if I could do...

  • Anonymous
    July 01, 2005
    In this post I published 100 lines of code that showed how to get a visual representation of your hard...

  • Anonymous
    July 26, 2005
    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.

  • Anonymous
    November 29, 2005
    If you want a full ( free ) app, then try "windirstat".

  • Anonymous
    May 10, 2006
    I think SequoiaView is a tad nicer. has been available since years.

    http://www.win.tue.nl/sequoiaview/

  • Anonymous
    July 19, 2006
    I was running really low on disk space on one of my machines, so I ran my Treemap utility on it (see...

  • Anonymous
    April 11, 2007
    Ich erklare meinen Freunden uber diese Seite. Interessieren!

  • Anonymous
    April 13, 2007
    Stupore! Amo questo luogo!:)))))))

  • Anonymous
    April 16, 2007
    Stupore! Amo questo luogo!:)))))))

  • Anonymous
    June 19, 2007
    Sometimes friends or relatives might hear that you’re an expert with using computers, and might ask you

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

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

  • Anonymous
    January 07, 2008
    I was running out of disk space on one of my machines, so I used my TreeMap program to see where I could

  • Anonymous
    January 07, 2008
    I was running out of disk space on one of my machines, so I used my TreeMap program to see where I could

  • Anonymous
    January 07, 2008
    PingBack from http://msdnrss.thecoderblogs.com/2008/01/07/uninstall-vb6-causes-error-message-you-do-not-have-a-license-to-use-this-control/

  • Anonymous
    January 16, 2009
    The comment has been removed