TreeInfo
========


A utility to find the size of directories (folders).


by Nick Gammon <nick@gammon.com.au>

http://www.gammon.com.au

Date: 8th August 1999


Purpose
-------

This utility was written to simplify cleaning up hard disks (and network drives) by making it easy to find which directories occupy the most disk space. Unfortunately, using the Windows Explorer you can only find out directory sizes one-by-one (by getting the properties of each directory).

The program takes a specified starting point (eg. C:\GAMES) and then scans that directory and all subdirectories (and sub-subdirectories and so on), calculating the amount of disk occupied by all files it finds.

It then lists the size of the files and directories in the starting directory. (See example below).

For each directory it lists the size and number of files in that directory (including subdirectories). In the case of files the size only is listed (in this way you can tell the difference between directories and files).

At the end of the listing is a line stating the total size of the nominated starting directory.

As the sizes are specified at the start of the line you can use the SORT command to sort the results into smallest to largest directory.

Usage
-----

TREEINFO [starting_directory]

If no starting-directory is specified, the default is C:\

eg.  TREEINFO C:\GAMES


Saving results to a file
------------------------

To direct output to a file for viewing or sorting, use the ">" symbol, as follows:

TREEINFO [starting_directory] > output_file

eg.  TREEINFO C:\GAMES > JOHN.TXT


Sorting results
---------------

To sort output, you can "pipe" the results from TREEINFO into SORT, as follows:

TREEINFO [starting_directory] | SORT /R > output_file

eg.  TREEINFO C:\GAMES | SORT > bill.txt

The /R option for the SORT utility sorts into reverse order, so that the directories taking the largest disk space appear first.

(The "pipe" symbol is the "vertical bar" which is probably on the "backslash" key on your keyboard).


Example
-------

treeinfo office95

produces the following:

[TREEINFO Version 1.00 Gammon Software Solutions]
   41.471 Mb    159 files  office95\Access
    1.531 Mb     14 files  office95\Clipart
   10.422 Mb     37 files  office95\Excel
    0.000 Mb               office95\Microsoft Access.lnk
    0.000 Mb               office95\Microsoft Binder.lnk
    0.000 Mb               office95\Microsoft Excel.lnk
    0.000 Mb               office95\Microsoft Office Setup.lnk
    0.000 Mb               office95\Microsoft Office Shortcut Bar.lnk
    0.000 Mb               office95\Microsoft PowerPoint.lnk
    0.000 Mb               office95\Microsoft Schedule+.lnk
    0.000 Mb               office95\Microsoft Word.lnk
    0.000 Mb               office95\MS Access Workgroup Administrator.lnk
    0.000 Mb               office95\MSCREATE.DIR
    3.068 Mb     69 files  office95\Office
   11.415 Mb     28 files  office95\Powerpnt
    3.189 Mb     51 files  office95\Schedule
    0.031 Mb      6 files  office95\Sounds
    6.963 Mb    129 files  office95\Templates
   14.448 Mb     65 files  office95\Winword

   92.540 Mb    568 files  office95  (total)


Sorted example
--------------

treeinfo office95 | sort /R

produces the following:

[TREEINFO Version 1.00 Gammon Software Solutions]
   92.540 Mb    568 files  office95  (total)
   41.471 Mb    159 files  office95\Access
   14.448 Mb     65 files  office95\Winword
   11.415 Mb     28 files  office95\Powerpnt
   10.422 Mb     37 files  office95\Excel
    6.963 Mb    129 files  office95\Templates
    3.189 Mb     51 files  office95\Schedule
    3.068 Mb     69 files  office95\Office
    1.531 Mb     14 files  office95\Clipart
    0.031 Mb      6 files  office95\Sounds
    0.000 Mb               office95\MSCREATE.DIR
    0.000 Mb               office95\MS Access Workgroup Administrator.lnk
    0.000 Mb               office95\Microsoft Word.lnk
    0.000 Mb               office95\Microsoft Schedule+.lnk
    0.000 Mb               office95\Microsoft PowerPoint.lnk
    0.000 Mb               office95\Microsoft Office Shortcut Bar.lnk
    0.000 Mb               office95\Microsoft Office Setup.lnk
    0.000 Mb               office95\Microsoft Excel.lnk
    0.000 Mb               office95\Microsoft Binder.lnk
    0.000 Mb               office95\Microsoft Access.lnk


From this you can easily see that Access is taking the most space inside Office95 directory.

Fee
---

This program is supplied free of charge. It is copyright 1998 by Nick Gammon. Source code is available upon request. Email: Nick Gammon <nick@gammon.com.au>


Update history
--------------

31st March 1998 - Version 1.00 - initial release.
14th April 1998 - Version 1.01 - changed total size from "long" to "__int64" as totals could exceed size of a long (ie. come out negative and wrong).
8th August 1999 - Version 1.02 - changed way it recursed directories, to report errors better. Specifically, "Access denied" messages should now appear when appropriate.

