DIRSIZE v2.6
============

Copyright 1993-1996 Simon A Carter

The Directory Size/Wastage Lister with the Lot:

    *  Summary statistics for multi-level directories. This is very useful
       for finding the complete size of applications before deletion or
       backup.
    *  Displays Windows 95 long filenames.
    *  For the selected drive, displays actual cluster size, free space,
       used space and capacity.
    *  For the directory tree, displays cluster size (user-selectable),
       total space used and wastage (as a percentage or as a value).
    *  For each directory displayed, shows total space, wasted space (as a
       percentage or a value), 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.
    *  Paginates output, [Enter] for next line, [Esc] to exit and any
       other key for next page. Disabled automatically if output is
       redirected.
    *  Output can be redirected to a file or to the printer or into
       another program. Redirection is automatically detected and turns
       off pagination.
    *  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 can be disabled.
    *  Future proof - directory sizes up to 99 GB are catered for.
    *  Progress indicator as it accumulates file information.


PRIVATE use of DirSize is FREE. Please register your usage by sending
email to Simon Carter at launch@ozemail.com.au, with your name and
address.

Paid registration (costing $US 5) is required for use in a business,
commercial, government or institutional environment. Please see the end of
this file for more information.


What will DirSize do for me ?
=============================

DirSize shows a graphical tree of the directories on your hard disk. The
tree starts from the current directory, or from a directory or directories
that you specify. The left column displays the total disk space used by
each directory. Directories that contain further sub-directories display
summary statistics in square brackets after the directory name. This is
very useful for determining the complete size of an application, for
example, if you were hunting for an application to remove to make way for
a new one. Alternatively, DirSize can be used to find the total size of an
application before a backup or copy is made.

DirSize automatically detects and displays Windows 95 long filenames. Of
course, it will still run under any older version of DOS.


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]

Where [options] is one or more of:
<directory>   Default: Current path
              
              One or more directories can be specified as the starting
              point for DirSize's output. For a DirSize of drives a:, b:
              and the current directory (c:\windows) type:
              
              c:\windows> dirsize a:\ b:\ .
              
              Directory names with special characters such as spaces must
              be entered with double quotes e.g.
              
              c:\> dirsize "Program Files" "windows\start menu"   [Enter]
              
              You can perform multiple DirSize command in a single run
              e.g.
              
              c:\> dirsize /1 c:\ /0 d:\
              
/nosort       Do not sort directory names into alphabetical order (the
              default). This may be useful if you are comparing DirSize's
              output to an unsorted listing from the DOS DIR command.
              
/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=#       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.
              
/#            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 subdivided 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 to show wasted space for each directory.
              
/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


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):

   c:\> dirsize "Program Files"    [Enter]
   DirSize v2.6  Copyright (c) 1993-1996 Simon Carter
   
   Total space     Wstd  Directory name   [dir + subdirs total]
   --------------  ----  ----------------------------------------------
           65,536   94%  C:\Program files   [215,154,688]
        1,310,720    7%  |--Accessories   [1,835,008]
          524,288   32%  |  +--HyperTerminal
           32,768   99%  |--Borland   [98,500,608]
           32,768   99%  |  |--Common Files   [4,358,144]
        4,325,376   10%  |  |  +--Bde
        4,096,000    6%  |  |--Database Desktop
          229,376   37%  |  +--Delphi 2.0   [90,013,696]
        9,207,808    9%  |     |--Bin   [9,699,328]
          491,520   98%  |     |  +--Borland Delphi 2.0
           32,768   98%  |     |--Demos   [18,710,528]
        5,898,240   35%  |     |  |--Data
           32,768   98%  |     |  |--Db   [4,292,608]
          294,912   91%  |     |  |  |--Dberrors
          360,448   94%  |     |  |  |--Filter
          360,448   95%  |     |  |  |--Find
          163,840   96%  |     |  |  |--Fishfact
          360,448   89%  |     |  |  |--Gdsdemo
          294,912   96%  |     |  |  |--Lookup
          983,040   82%  |     |  |  |--Mastapp
          425,984   96%  |     |  |  |--Navmdi
          425,984   96%  |     |  |  |--Navsdi
          196,608   95%  |     |  |  |--Ndxbuild
          229,376   91%  |     |  |  |--Qbfdemo
          163,840   97%  |     |  |  +--Qjoin
           65,536   95%  |     |  |--Demolbl
           32,768   98%  |     |  |--Doc   [3,735,552]
          360,448   98%  |     |  |  |--Autoproj
           65,536   91%  |     |  |  |--Calendar
          229,376   97%  |     |  |  |--Cbrowse
           65,536   93%  |     |  |  |--Dataedit
           65,536   96%  |     |  |  |--Dbcal
          884,736   60%  |     |  |  |--Filmanex
          917,504   96%  |     |  |  |--Graphex
          163,840   84%  |     |  |  |--Oleword1
          163,840   85%  |     |  |  |--Oleword2
           65,536   95%  |     |  |  |--Shape
          229,376   94%  |     |  |  |--Textedit
          163,840   97%  |     |  |  |--Vararray
          163,840   98%  |     |  |  |--Varlock
          163,840   84%  |     |  |  +--Vartoint
          229,376   96%  |     |  |--Imagview
          458,752   87%  |     |  |--Ipcdemos
           32,768   99%  |     |  |--Oleauto   [983,040]
          557,056   35%  |     |  |  |--Autoctrl
          393,216   94%  |     |  |  +--Autoserv
          425,984   90%  |     |  |--Olectnrs
          131,072   98%  |     |  |--Ownerlst
          163,840   94%  |     |  |--Propedit
          655,360   83%  |     |  |--Quickrpt
          884,736   55%  |     |  |--Resxplor
          294,912   78%  |     |  |--Richedit
          458,752   59%  |     |  +--Threads
        1,409,024   67%  |     |--Doc
       30,670,848    2%  |     |--Help   [32,833,536]
        2,162,688    6%  |     |  +--Tools
           32,768   99%  |     |--Images   [8,355,840]
          851,968    9%  |     |  |--Backgrnd
        5,341,184   98%  |     |  |--Buttons
          589,824   98%  |     |  |--Cursors
          229,376   99%  |     |  |--Default
          688,128   98%  |     |  |--Icons
           32,768   99%  |     |  +--Splash   [622,592]
          229,376   47%  |     |     |--16color
          360,448   38%  |     |     +--256color
        9,863,168   58%  |     |--Lib
        1,212,416   96%  |     |--Objrepos   [2,097,152]
          360,448   96%  |     |  |--Logoapp
          262,144   94%  |     |  |--Mdiapp
          262,144   96%  |     |  +--Sdiapp
           32,768   99%  |     |--Ocx   [360,448]
          327,680   28%  |     |  +--Chartfx
        2,293,760    2%  |     |--Quickrpt
        1,048,576   21%  |     |--Register
          557,056   58%  |     +--Source   [3,112,960]
          557,056   56%  |        |--LFNit!
           32,768   99%  |        |--Rtl   [1,703,936]
        1,671,168   18%  |        |  +--Win
          196,608   68%  |        |--Samples
           98,304   35%  |        +--Toolsapi
        1,933,312   16%  |--ClickBook
           32,768   99%  |--Common Files   [16,547,840]
           32,768   98%  |  +--Microsoft Shared   [16,515,072]
          589,824   16%  |     |--Artgalry
          851,968   16%  |     |--Equation
        2,031,616   28%  |     |--Grphflt
        2,293,760    4%  |     |--Msgraph5
          491,520   21%  |     |--MSinfo
        1,572,864   27%  |     |--MSquery
        1,703,936   10%  |     |--Orgchart
        2,883,584    6%  |     |--Proof
        2,031,616   13%  |     |--Textconv
        1,409,024   11%  |     |--Vba
          622,592   22%  |     +--Wordart
          688,128   21%  |--Font Assistant
        3,047,424   38%  |--Games
           98,304   85%  |--Help Assistant
        5,275,648   17%  |--Jobint
          819,200   25%  |--Lviewpro
           98,304   62%  |--Microsoft Exchange
        6,684,672   19%  |--Norton AntiVirus   [7,274,496]
          589,824   51%  |  +--System
        2,326,528    7%  |--Norton Commander   [2,359,296]
           32,768   99%  |  +--Indexing
        9,011,200    9%  |--Norton Utilities   [15,007,744]
        5,996,544   19%  |  +--System
       11,304,960    3%  |--Painter3   [15,761,408]
          589,824   11%  |  |--Movies
          622,592   21%  |  |--Nozzles
          753,664    8%  |  |--Sessions
          851,968   46%  |  |--Supplies
        1,638,400    8%  |  +--Tutorial
          720,896   15%  |--Plus!   [2,424,832]
        1,179,648   19%  |  |--Setup
          524,288   40%  |  +--System
          294,912   51%  |--Resource Kit
        5,603,328   14%  |--Resumew   [10,027,008]
          786,432   85%  |  |--Letters   [1,081,344]
          294,912   90%  |  |  +--Mrg_let
        3,342,336   67%  |  +--Resumes
        1,769,472   28%  |--Symantec
        1,245,184   24%  |--The Microsoft Network
        1,835,008   15%  |--Type twister
          720,896   20%  |--UltraEdit
        2,162,688   32%  |--VendInfo
        4,194,304    3%  |--Visio   [21,168,128]
        2,752,512   14%  |  |--Add-ons
          557,056   27%  |  |--Drawings
        3,244,032    5%  |  |--Help
           32,768   99%  |  |--Stencils   [4,882,432]
        4,849,664   10%  |  |  +--Standard
          131,072   51%  |  |--System   [4,718,592]
          393,216   89%  |  |  |--Custom
        2,162,688   23%  |  |  |--Filter32
        1,310,720   21%  |  |  |--Setup32
          720,896   12%  |  |  +--Spelling
           32,768   99%  |  +--Template   [819,200]
          491,520   68%  |     |--Standard
          294,912   48%  |     +--Wizards
          294,912   67%  |--winhack
        2,555,904    8%  |--Winres
        1,343,488   33%  +--WinZip
   --------------  ----  ----------------------------------------------
      215,154,688   25%  Cluster size: 32,768  Wastage: 54,922,146
   --------------  ----  ----------------------------------------------
   
   Drive C: statistics:
      Cluster size:         32,768 bytes
        Free space:     87,031,808 bytes (8% of capacity is free)
        Used space:  1,000,701,952 bytes
          Capacity:  1,087,733,760 bytes


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


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.


New features/Revision history
=============================

Date       Version   Changes Made
14-Oct-96  2.6       Added wastage percentage/value to display.
                     Changed display format.
                     Added wastage information for each directory.
                     Increased speed (again).
                     Added comma-delimited and tab-delimited database
                     output formats.
                     Added the actual size of the entries in each
                     directory to the total size count.
                     Added ability to limit directory depth and to specify
                     multiple directories with separate parameters for
                     each.
24-Jun-96  2.5       Reduced stack usage further.
                     Added /nosort, /size=# and /p option.
                     Added automatic pagination.
                     Fixed bug for paths longer than 68 characters.
                     Re-instated stack checking.
13-Jun-96  2.4       Increased stack limit to 64K, and reduced stack
                     usage. This means that you can list directories that
                     are much deeper than before. Appreciably faster (11
                     seconds compared to 14 for a complete display of a
                     1.1 Gb drive).
                     Now only shows usage information if /?, ? or -h given
                     as first parameter.
                     Email and address changes.
27-May-96  2.3       Documentation update.
8-May-96   2.2       Shows usage information if no parameters are
                     provided.
                     Fixed bug in long filename functions that prevented
                     them from working under some circumstances.
                     Fixed bug in file size rounding up function, which
                     made files that were an integral number of clusters
                     long one extra cluster long.
                     Documentation update.
28-Apr-96  2.1       First release.
3-Jul-93   1.0       First created and used.


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

PRIVATE use of DirSize is FREE. 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.

Paid registration (costing $US 5) is required for use in a business,
commercial, government or institutional environment. If you like and use
DirSize, I'd appreciate a postcard, money, a link from your WWW home page
or *any* other sort of recognition!


Online Web registration
-----------------------

You can register your copy of DirSize and electronically receive the
registered version within minutes through our online registration service:

  http://www.alberts.com/


Order form
----------


    Personal details
    ----------------
    
           Name: ____________________________________________
        Company: ____________________________________________
        Address: ____________________________________________
                 ____________________________________________
                 ____________________________________________
                 ____________________________________________
          Phone: ____________________________________________
            Fax: ____________________________________________


    For Visa, MasterCard or Bank Card (*)
    -------------------------------------
    (Sorry, I currently do not accept American Express)
    
    Card Number: ____ ____ ____ ____
    Expiry Date: ____/______
    
    
      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 an Australian
    bank. Foreign cheques cost me an additional $US 10 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.


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!

  Email:  launch@ozemail.com.au
    WWW:  Checkout the Crystal Software home page at
          http://www.ozemail.com.au/~launch
    Fax:  +61-3 9800-3078  Any time.
  Voice:  +61-3 9809-0172  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.
    
