About ...

I liked the program SpaceMonger for windows. Since it's far better than X11's "xdu", and because I had reinstalled windows and temporarily lost SpaceMonger, I decided to write my own version in Python.

Screenshot ...

Invocation ...

Invoke with no arguments pick directory from a nasty-looking dialog
Invoke with one argument show usage in that directory and its children
Invoke with argument "-" (Unix only) read du-style output from stdin
drag a folder to the program icon (Windows only) usage of that folder

Interaction ...

Left-click to decend into a directory. If you click a file, you descend to its parent. If you click a directory, you decend to the directory.

Right click to ascend one directory level.

"q" to exit

"1" .. "9", "0": show 1..9, or unlimited levels of files/directories

You can usually give TkDu commands while it's still busy drawing, but it may take a second to respond.

Download ...

tkdu-1.4.2.py Current version of tkdu (python source)
tkdu-1.4.1.py (python source)
tkdu-1.4.py (python source)
tkdu-1.3.py (python source)
tkdu-1.2.py (python source)
tkdu-1.1.py (python source)
tkdu.py (python source)
tkdu.exe Coming soon: Native Windows executable of tkdu

Changes ...

1.4.2
1.4.1
1.4
1.3
1.2
1.1

Algorithm ...

I didn't read anything about Treemaps before starting my implementation. My approach is simple:

  1. Decide whether to partition at the top or at the left
  2. Decide about how high (wide) this strip should be
  3. Choose files until the width (height) of the strip is used up
  4. Calculate the exact width and the exact box sizes. For directories, schedule the drawing of its children.
  5. While files remain, repeat algorithm on those files in the remaining area
Thus, larger files are on the top or left of their area. I need to tweak the algorithm to favor allocations that let more files/folders get labels. This means wider, shorter allocations, at least of files. Also, when there are many small files, rounding errors leave an empty rectangular area in the lower right of a folder.

License

Copyright (C) 2002-2004 Jeff Epler

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.