DIRSIZE v3.0 - Disk usage and wastage in a directory tree
=========================================================

Copyright (c) 1993-8 Simon A Carter for Crystal Software

DirSize is SHAREWARE, and may be trialed for 30 days. If you find DirSize
useful and plan to continue using it, you must pay for it. See the end of
the file for more details. Please register on the DirSize mailing list by
sending email to Simon Carter at launch@ozemail.com.au, with your name and
any comments.


What's New - 12-Jan-1998
========================

    *   32 bit Windows 95/NT version available in addition to 16 bit
        DOS/Windows 95 version.
    *   New and improved sorting options  total, local, waste, files
    *   Full scrolling support in either direction.
    *   The date and time is added when DirSize's output is redirected.
        A form feed is also added to eject the page when redirecting to
        a print.
    *   Now uses InstallShield for simple install/uninstall.
    *   Now includes file count display column (can be toggled on and
        off).
    *   If a directory is excluded from display because it is deeper or
        smaller than specified by the user, the parent directory name
        has '...' added to it and the wastage and file count of the
        excluded directory are added to the parent's.
    *   New GUI configuration utility for setting default parameters for
        the Windows 95/NT version.
    *   Now only one directory can be specified on the command line 
        but this makes it easier to change one option and re-run
        DirSize.
    *   Default for wastage display now back to a % display.
    *   Fixed bug that prevented directories starting with '.' being
        processed.
    *   Fixed math overflow when G specifier used eg size=2G.
    *   Fixed bug with redirection of prompt/progress indicator.


Benefits
========

DirSize shows you how much disk space is used and wasted in each
directory.

Its uses include:

    *   Finding space hogs on a network
    *   Finding multiple copies of a single application on a server
    *   Finding which directories could be archived to save space
        (typically those that contain lots of small files)
    *   Finding where most of the disk space is used
    *   Finding applications to remove before installing a new one
    *   Previewing the benefits of a smaller cluster size
    *   Generating daily, weekly or monthly reports showing how the disk
        space distribution has changed. You can easily generate tab- or
        comma-delimited output to feed directly into your favourite
        spreadsheet for further analysis
    *   Showing you the complete directory tree

On large hard disks up to 1/4 of the total drive space is wasted! DirSize
will show you where.

It runs under DOS, Windows 3.x, 95 and NT, and supports long filenames
under Windows 95 and NT.


Features
========

    *   Summary statistics for multi-level directories. This is very
        useful for finding the complete size of applications before
        deletion or backup.
    *   Displays Windows 95/NT long filenames.
    *   Supports international thousands separators.
    *   The directories to be displayed can be limited by their size or
        depth; very useful for eliminating unnecessary detail.
    *   For the selected drive, displays actual cluster size, free
        space, used space and capacity.
    *   For each directory tree specified, displays cluster size (user-
        selectable), total space used and wastage (as a percentage or as
        a total).
    *   For each directory displayed, shows total space, wasted space
        (as a percentage or as a total), and if it has subdirectories,
        the total space used by the directory and all of its
        subdirectories.
    *   Shows wasted space for a given cluster size - optimise your
        cluster size before repartitioning your hard disk.
    *   Rounds up file sizes to the cluster size for the most accurate
        size information.
    *   Size/wastage information includes the size of directories
        themselves.
    *   Full scrolling support in either direction. Disabled
        automatically if output is redirected.
    *   Output can be redirected to a file or to the printer or into
        another program.
    *   The characters used to draw the directory tree can be changed
        from DOS extended ASCII characters to standard ASCII characters
        for other operating systems.
    *   Comma-delimited and tab-delimited output formats for easy
        importing into databases, spreadsheets or word processors for
        further analysis or specialised printing.
    *   Directory sorting by name, total or local size, wastage or file
        count.
    *   Future proof - directory sizes up to 99 GB are catered for.
    *   Progress indicator as it accumulates file information.


Installation
============

Just copy DIRSIZE.EXE to a directory in your path, for example, to C:\DOS.
To find out the directories in your path, type

   c:\> path    [Enter]


How to use DirSize
==================

Typing

   dirsize -?   [Enter]

on its own will display usage information.

Usage:
   dirsize [options] [directory] [options]

Where [options] is zero or more of:
[directory]   Default: Current path
              
              The directory to process. This may be a UNC path
              (\\computer_name\share_name\path). Directory names with
              special characters such as spaces must be entered with
              double quotes e.g.
              
              c:\> dirsize "Program Files"   [Enter]
              
-sort=        Default: name
 [name  |     
  local |     Specifies the sort order:
  total |     
  waste |       Name - sort by directory name in alphabetical order.
  files |       
  none          Local - sort by local size, largest first.
 ]              
                Total - sort by total size, largest first.
                
                Waste - sort by wasted space, largest first (not as
                percentage of overall space).
                
                Files - sort by number of files, largest first.
                
                None - do not sort. This may be useful if you are
                comparing DirSize's output to an unsorted listing from
                the DOS DIR command - each directory is displayed in the
                same order it was retrieved from disk.
              
-p            Do not paginate the output. Pagination pauses after each
              screenful of output. [Enter] shows the next line, [Esc]
              exits, [End] scrolls continuously to the end of the output,
              and any other key shows the next screen full of output.
              Pagination is automatically disabled when the output is
              redirected.
              
-size=#       Only show directories that use # space or larger. A K, M or
              G suffix can be used to express the value in KBytes (1024
              bytes), MBytes (1024 KBytes) or GBytes (1024 Mbytes). This
              is very useful for finding network space hogs, or for
              eliminating small directories that are of no consequence
              from the display.
              
-cl=#         Show how much disk space would be wasted if the cluster size
              was set to # bytes per cluster. # is restricted by DOS to
              powers of two, but for convenience DirSize allows it to be
              set to any value. This is useful for previewing the result
              of a change in cluster size on a set of files. In general,
              the smaller the cluster size, the smaller the wasted space.
              As for -size=# above, a K, M or G suffix can be used.
              
-dir          In this mode, DirSize does not round up the space used by
              each directory (the local size, not including any
              subdirectories). DirSize also ignores the space used in each
              directory by DOS for housekeeping.
              
-#            Default: All levels (255)
              
              Limits the number of levels of directories displayed to the
              given value. Eg -1 will only show the first directory level.
              The statistics will include all levels, but they will not be
              displayed. This is very useful if you just need to find out
              how much total space is in use by an application without
              caring how it is divided into sub-directories. A value of 0
              is equivalent to a value of 255 (i.e. all levels).
              
-comma        Print the result in a comma-delimited output format suitable
              for importing into a spreadsheet, database or word
              processor.
              
-tab          Same as -comma above but outputs in tab-delimited format.
              
-nowaste      Do not show wasted space for each directory. The wasted
              space is still included in the totals - it is just not shown
              as a display column.
              
-asval        Show the actual wasted space per directory rather than as a
              percentage of the directory's used space.
              
-c<+|->       Control which characters to use for drawing lines.
              
              + Uses DOS's graphical line drawing characters even if it
              detects that its output is being redirected.
              - Uses portable text line drawing characters even if it
              detects that its output is not being redirected. This is
              useful if the result is going to be used on another
              computer, for example, on a Unix machine or a Macintosh.
              
              Note: When DirSize detects that its output is being
              redirected, it automatically turns off pagination, and
              selects portable characters to draw lines, such as +, - and
              |. It does this because the output may be sent to a device
              or another computer that does not understand DOS's line
              drawing characters (which are non-portable). When DirSize's
              output goes to the screen, it uses the DOS line drawing
              characters. You can override the default behaviour in either
              case using the -c option


DirSize Environment Variable
============================

If you regularly use the same settings for DirSize, you can set them in
the environment variable DirSize. This variable is processed before
command line options, so anything specified on the command line will
override it.

e.g.

   SET DIRSIZE=-nowaste -c- -nosort

Some of DirSize's command line options require an equals sign. In order to
use these in an environment variable, change the equal sign (=) to a colon
(:) eg -cl=# becomes -cl:#.


Redirecting Output
==================

DirSize's output can be redirected to any device. For example, to save
DirSize's output to the file output.txt, you can type:

   dirsize > output.txt    [Enter]

To add DirSize output to an existing file exists.txt, type

   dirsize >> exists.txt    [Enter]

To send DirSize's output to the printer, type

   dirsize > prn    [Enter]


DirSize Example
===============

The output below was generated from running DirSize in the Program Files
directory (in a DOS shell under Windows 95). All directories smaller than
2 MB have been removed from display:

   c:\> dirsize d:\ -2    [Enter]
   DirSize v3.0  Copyright (c) 1993-8 Simon Carter for Crystal Software
   
    Total-no subs  Wstd  Files  Directory name   [dir + subdirs total]
   --------------  ----  -----  -----------------------------------------
                0    0%      0  D:\   [239,828,992]
            4,096   92%      0  |--Games   [157,437,952]
          593,920   13%     19  |  |--Larry1
          946,176    4%     11  |  |--Larry2
          913,408   24%     52  |  |--Lemmings
       28,327,936    5%    362  |  |--Mech2 ...   [63,311,872]
        1,024,000    7%     17  |  |--Quake ...   [19,726,336]
        9,408,512    3%     67  |  |--Starcon2
       61,587,456    1%    226  |  |--Starcon3
          946,176    5%     10  |  +--Zork
            4,096   95%      0  |--Installation Zips   [69,320,704]
        5,595,136    0%      1  |  |--cardshop
        6,418,432    0%      5  |  |--Driver disks for '95
       56,303,616    0%     56  |  |--Osr2
          999,424   12%     33  |  +--Powerup
        2,920,448    1%      4  |--Recycled
        6,676,480    2%     38  +--zips   [10,149,888]
        3,260,416    3%     20     +--New stuff ...   [3,473,408]
   --------------  ----  -----  -----------------------------------------
      239,828,992    2%    921  Cluster size: 4,096  Wastage: 3,696,755
   --------------  ----  -----  -----------------------------------------
   
   Drive D: statistics:
      Cluster size:          4,096 bytes
        Free space:      6,615,040 bytes (  3% of capacity is free)
        Used space:    238,186,496 bytes
          Capacity:    244,801,536 bytes


Note how all sizes shown (except the wasted space) are integral (whole)
multiples of the drive's cluster size.

When DirSize has produced a display, you can press:
     [W]   To toggle the wastage display on and off
     [D]   To alternate the wastage display format between a percentage of
           the total space used or as an actual value
     [F]   To toggle the file count display on and off
     [A]   Alternates the display of tree characters betweeen standard
           ASCII and graphic line-drawing characters.



What is the "Cluster Size" ?
============================

When your computer places files on a disk (both hard disks and floppy
disks), it must use an integral number of allocation units. The size of
the allocation units varies depending on the total capacity of the disk.
This means that if a file is smaller than one complete allocation unit, it
does not fill the entire allocation unit. For example, lets say we have a
file that is 300 bytes long. On a floppy disk with an allocation unit of
512 bytes, the file will only occupy the first 300 bytes, but since one
entire allocation unit must be used, the remaining 212 bytes are wasted. A
file 513 bytes long will occupy 2 allocation units, with 511 bytes wasted.
An allocation unit is called a CLUSTER. Floppy drives typically use a
cluster size of 512 bytes or 1,024 bytes, so not much space is wasted.
Hard disks range from 2,048 bytes (for a 106 MB drive) to 32,768 bytes
(for a 1.04 GB drive) and even 65,535 bytes, which means that a great deal
of space is wasted. The cluster size gets bigger with bigger disks for two
reasons:

   1)    A DOS limitation that sets an absolute upper maximum on the total
         number of clusters on a drive (65535).
   2)    The overhead of managing a large number of clusters consumes a
         lot of disk space that cannot be used for anything else.

The DOS DIR command always shows you the size actually in use by the file
- it does not include the extra 'wasted' space at the end of the cluster.
This wasted space is sometimes referred to as 'slack' space.


Directories use up clusters too
===============================

DirSize takes into account the amount of disk space used to store the
entries within each directory. Normal file, directory and volume label
entries take up 32 bytes each. Long filename entries can consume between 1
and 32 additional directory entries (each of 32 bytes).

Even empty directories use a minimum of one cluster - for the current
directory "." and the parent directory ".." entries. The root directory
always consumes a fixed and pre-determined amount of disk space which
cannot be reclaimed, and DirSize excludes the number of entries in the
root directory from its calculations.

DirSize does not take into account the size of entries that are no longer
being used. This means that a directory that has had many files deleted
may display a size lower than that actually in use. DOS never reclaims
this extra space unless you delete the directory.

To reduce the amount of disk space used by directories, remove directories
that do not contain any files. Also, if you delete a large number of files
from one directory (particularly directories containing long filenames),
move the files to a new directory, remove the old one and then rename the
new directory to the original name.


Lost clusters
=============

Clusters can become orphaned when DOS is unable to complete changes to the
disk, for example, when you are forced to reboot your machine or when the
power is turned off accidentally. These clusters cannot be used until they
are identified and reclaimed. Use the DOS CHKDSK or SCANDISK command to
reclaim lost clusters. Lost clusters are considered to be used.


Reducing wasted space
=====================


What about Disk Compression ?
=============================

Disk compression programs like Stacker and DoubleSpace are able to make
use of the wasted space because they take on the responsibility of storing
the files themselves. By doing so, they overcome DOS's integral cluster
size limitation. DirSize's space wasted information may be invalid on
volumes controlled by these programs, and on some later versions of file
servers.


What about archives ?
=====================

Storing collections of files in a compressed or uncompressed archive saves
space, because by grouping all of the files into one large file, only a
small amount of space is wasted. The archive program uses its own format
to store the files without wasting space.


Partitions - decreasing the cluster size
========================================

Partitions subdivide a physical disk drive into a number of logical
drives. For example, a 500 MB hard disk could be partitioned into two
250MB partitions, C: and D:. The advantage of doing this is that the
cluster size can be smaller, and in general, the amount of wasted space
will be smaller. The disadvantage is that it takes time to set up (since
you have to move ALL of your data off the hard disk in order to partition
it, unless you have a program that can re-partition on the fly), and you
have to remember which drive your programs are on, and manage space across
two drives instead of one. For more information on partitions, see the DOS
FDISK command.


Registration
============

DirSize is SHAREWARE and may be trialed for a period of 30 days. After
this time you must either purchase the registered version (for $15) or
cease using the shareware version.

Please register your USAGE of DirSize by sending email to
launch@ozemail.com.au, with your name and address, version of DirSize and
any relevant comments or suggestions. By registering DirSize I can inform
you of updates or improvements and let you know when the next version is
released.

If you like and use DirSize, how about linking to my Web site (see below)?


Online Web Registration
=======================

The registered version of DirSize can be purchased and received
immediately on the Internet, eliminating shipping and handling costs.


Albert's Ambry
--------------

Direct URL:
http://www.alberts.com/Ambry/Register?File_Name=dirsize.zip&OS=Win95&Sourc
e=AuthWWW

OR go to

  http://www.alberts.com

and search for: DirSize

Click on the "Buy it" hotlink to register DirSize.


Crystal Software Order Form
===========================

Use this form for orders sent directly to Crystal Software in Australia.
    
    ____ x Single user licence(s) at  $15 each: $______
    ____ x Server licence(s)      at $150 each: $______
    ____ x Site licence(s)        at $300 each: $______
    ____ x Company licence(s)     at $500 each: $______
    
    Postage and 3.5" diskette          (  )         $10
      OR                                OR        OR
    Deliver to your email address      (  )    * free *
    
                                        Total: $_______
    
    
    Personal details
    ----------------
    
           Name: ____________________________________________
          Email: ____________________________________________
        Company: ____________________________________________
        Address: ____________________________________________
                 ____________________________________________
                 ____________________________________________
                 ____________________________________________
          Phone: ____________________________________________
            Fax: ____________________________________________


    Visa or MasterCard (*)
    ----------------------
    
    Please tick: ( ) Visa     ( ) MasterCard
    Card Number: ____ ____ ____ ____
    Expiry Date: ____/______
    
    Card holder name: ________________________________
    
      Signature: ________________________________
    
           Date: ____________
    
    (*) Please note that these orders are processed by Omnivision
    Technologies, a licensed distributor.
    
    
    Cheques
    -------
    I accept bank cheques and personal cheques drawn on Australian banks.
    For foreign cheques, please include an additional $US 5 to cover my
    bank's foreign cheque charge. Please make cheques payable to Simon
    Carter.
    
    
    Postal money orders
    -------------------
    I accept prepaid postal money orders in Australian dollars.
    
    
    Other Payment Methods
    ---------------------
    I also accept foreign currencies (suitably disguised within an
    envelope) provided they allow an extra $5 for currency conversion.


Contact Information
===================

I am always happy to hear your comments! If you use and like DirSize, or
have any suggestions for improvements, please drop me a line! Other user's
suggestions have made it what it is today.

 Email:     launch@ozemail.com.au
   WWW:     http://www.ozemail.com.au/~launch
   Fax:     +61 (3) 9800-3078
 Voice:     +61 (3) 9888-3104. After hours number. Please leave a
            contact name, number and time, and I will try to get back
            to you within 24 hours.
  Mail:     Simon Carter
            Crystal Software
            2 / 9 Woodbine Court
            Wantirna
            Victoria 3152
            AUSTRALIA.
    

