This modest Python 3.X program generates a report giving the total space taken by each folder and file in a directory tree, grouped by type and ordered by size. This includes all the subfolders nested in the tree; each folder's size is computed from its contents recursively. After a run, search the report for "[Directories]" and "[Files]" to find your largest items.
This script's main goal is to help locate candidates for removal when reclaiming disk space; navigating with file explorer GUIs tends to be tedious (or unusable) in this role. Its report file also provides a snapshot of the contents of your folders or drives. While there are tools to do similar work on some platforms, treesize is a portable option that works everywhere that Python does.
Code and docs:
Examples:
Use the following to fetch treesize, or view its unzipped content.
This program was last changed: June 2017.
Recent upgrades: treesize includes a minor update to skip symlinks on platforms that support them, so the size tally isn't inflated artificially. Symlinks are rare on Windows, but not on Mac OS or Linux. See the script's docstring for details. This script has also now been shown to handle non-ASCII filenames properly on all Python/platform combinations tested (without the perils of its CGI-script comrades here and here).
For more code examples, see the programs page.