Contents of the DU.DOC file
DU.EXE - Disk Usage Tree
DU is a handy utility for cleaning up your hard drive. It
prints a directory tree similar to DOS's TREE command. The main
difference between DU and TREE is that the amount of space taken up by
the files in each directory is displayed next to the directory name.
Additionally, at the end of the DU tree, a total is printed listing
the total number of files in the tree, and the total size of all files
in the tree.
Total For C:\SRC\WS5 is 4.55M in 211 files.
Total Wasted in partial clusters is 0.23M for a grand total of 4.78M.
The size listed next to each directory in the tree is the sum
of the sizes of all of the files in that directory. The size listed in
the first total line is the sum of sizes calculated for each directory.
The grand total listed in the last line is the sum of the previous total
and the total amount wasted in partial clusters.
A partial cluster is a disk cluster that is not full. When DOS
writes a file to disk it must use whole numbers of disk clusters.
Because of this, the last cluster in each file is partially wasted. For
example, if your hard drive has a cluster size of 4096 (4K) bytes, and a
directory lists a file with a size of 5000 bytes, this file will take 2
whole clusters - 8192 bytes (8K). Thus this file has wasted 3192 bytes
in its second cluster.
If your tree has a lot of files, the number of bytes wasted will
be larger than a tree with only a few files. No matter how large a file
is, it will only waste a maximum of the cluster size - 1 bytes.
The size listed next to each directory and totaled in the first
total line will match that returned by the dir command. The grand total
listed in the last total line will match that returned by chkdsk.
DU has a number of command line switches that make it more
flexible. The following is returned when an invalid switch is entered:
C:\> du /h
Usage: DU [/b] [/k] [/t] [/a] [/d]
/b - list totals in bytes
/k - list totals in kilobytes
/t - list totals only (no tree)
/a - use ASCII characters rather than extended
/d - deletes the entire tree
By default, DU lists totals in Megabytes (M). The /b and /k
switches can be used to list totals in bytes (B) and kilobytes (K)
respectively. The /t switch can be used alone, or in combination with
any of the others to list the totals only.
The /a switch is useful when sending output to a printer that
will not use the IBM extended character set. No extended characters
are printed when the /a switch is used.
The /d switch is probably the most useful. Current software
packages tend to install themselves in trees of their own, as shown in
the first example. When cleaning up a hard drive, deleting a lot of
sub-directories can be a pain. Using DU with the /d option will
display a regular DU tree, then ask if you wish to delete the entire
tree. If you answer Y, all files and directories shown will be deleted.
THIS INCLUDES THE CURRENT DIRECTORY. Answer anything else to this
question and your files will be unharmed.
Please feel free to distribute this program and document
(together please!) to anyone who wants it. I have found it useful, as
has everyone I have given it to. If you have and questions, comments,
or suggestions, please send them to me at my account on the Programmer's
Corner BBS (410) 995-6873 or through low-tech mail at the address below.
10833 Olde Woods Way
Columbia, MD 21044