                    _____________________________

                        Haywire Software (HSw)

                              presents


                         Z D U  -  release 2


               (C)Copyright 1995-1999 Haywire Software

      
                             Written by:

                            Andr Jonsson

                        haywire@fatalunity.com
                    _____________________________




                       Contents of this file:

  
                           1. DISCLAIMER
                           2. INTRODUCTION
                           3. REQUIREMENTS
                           4. INSTALLATION
                           5. FEATURES
                           6. SYNTAX & USAGE
                           7. KNOWN BUGS & REPORTS
                           8. VARIOUS
                           9. DEVELOPMENT
                          10. AUTHOR
                          11. BACKGROUND
                          12. FUTURE IDEAS
                          13. HISTORY









1.  DISCLAIMER
	
    THIS PROGRAM IS DELIVERED "AS IS" AND ANY USE OF THIS PROGRAM IS AT YOUR
    OWN RISK! THE AUTHOR (OR THE SUPPORTING AUTHOR(S)) DOES NOT TAKE ANY
    RESPONSABILITY FOR ANY LOSS, OR DAMAGE (PHYSICAL OR MENTAL), OF NEITHER
    DATA, SOFTWARE, NOR HARDWARE, FROM DIRECT OR INDIRECT USAGE OF THIS
    PROGRAM.


2.  INTRODUCTION

    Zdu is a little tool that can come in handy when cleaning up your hard-
    drive and general disk information.

    The idea behind Zdu is to scan a path (one or more) and report the content 
    therein, how many directories, how many files and how much a specific 
    directory allocates on the harddisk. 

    You may now think: "What about selecting 'properties' on a folder in 
    windows?". To cut it short, that feature simply sucks, and will decieve 
    you by reporting sometimes a completely wrong directory size. This is 
    mainly because of the way the filesystem works. Zdu determines the 
    filesystem type and the minimum allocateable size on (i.e. clustersize), 
    and makes all size calculations according to this.

    There are several, somewhat similar, programs available on the net today, 
    though none of them, fills my needs, Also, most of them are like >150k in 
    size, fancy graphical interface and all that gibberish, which I do not 
    need, hence Zdu R2 was born :-)


3.  REQUIREMENTS

    A computer.

    More specific: an IBM "compatible" PC.
	
    Even more specific:

        CPU: Pentium or higher
        MEM: about 1Mb
        OS:  Windows 9x/NT(intel)
        Free disk space: ~100k  (including zip file and installed)
	
    And to put it to some good use a harddisk is recommended.

    At this time no NT-Alpha version has been compiled because I don't have
    access to any Alpha with NT, but if anyone need an Alpha version donations
    are welcome! :-)

    Memory requirements could probably be more, but it seldom uses more than
    just over 700k. Infact, on my E: drive (now consisting of 28000 files in
    2000 dirs with a tree depth of 11) it takes 760k memory (+300k virtual).

    And if you think zdu is slow, get a new HD, because over 90% of the CPU
    power (on my machine) is system time.


4.  INSTALLATION

    Copy the executable file to any directory, preferrably to one that you 
    have search-path to (it's more convienient that way).


5.  FEATURES

    Zdu's main feature is to scan a given directory and return the ammount of
    space that it allocates on disk. As default the directories in the 
    directory specified will be accounted for separately, as a total size as 
    well. Please note that Zdu returns the REAL size that the specified path 
    really allocates (for supported filesystems), as opposed to most programs 
    that just returns all file-sizes added together (which basically is just 
    crap).

    An optional filemask can be given to only return allocated size for
    certain files.

    A simple example of Zdu output when running it on my E: drive:

    ---example begin---
		E:\>zdu /h
		Disk E: "DATA" 3760:353D - FS:FAT32 - Cluster:8k
		Total: 15 711 338 496 [11G] - Free: 12 146 425 856 [14G]
		 Usage(B)   Dirs   Files  Eff  Path:
		--------------------------------------------------------------
			 262M    843   12014  76%  data
			 7.4M      2      48  97%  usr
			 170M     78     656  97%  haywire
			  14M     33     210  93%  RECYCLED
			 100M     13     142  99%  stefan
			 551M    747   10093  90%  download
			 1.8G    247    5098  98%  turbo
			 388M      2     430  99%  render
		--------------------------------------------------------------
			 3.4G   1973   28692  95%  E:\
		E:\>_
    ---example end---

    Above is the output from Zdu using the new human readable format
    switch (/h), which is new from version 2.2.


6.  SYNTAX AND USAGE

    Zdu 2.2 has the following commandline syntax: (result of typing zdu /?)

    ---------------------------
	Zdu v2.2 - (C)1995-99 Haywire Software (HSw)                    Aug 14, 1999
	Feedback email: haywire@fatalunity.com

	Usage: Zdu /<switches> path1[\filter1] ... pathN[\filterN]
	<switches>
	  c        Print usage in clusters, instead of bytes
	  d        Do not count directories as an allocated cluster
	  f[:N]    Fake clustersize to N bytes
	  h        Print usage in human readable format (e.g. 1.2M, 34k)
	  k        Print usage in units of 1024 (also clusters)
	  q        "Quick" mode
	  r        Print usage recursive
	  s        Silent mode
	  t        Collect non-standard sTream sizes also
	  x[:sort] Show eXtension usage table, sort can be on of these:
		x        Sort by eXtension (ascending)
		u        Sort by Usage (descending)
		n        Sort by Number of files (descending)
	  F:<fmt>  Format of output. <fmt> can be one or more of the following:
		0        Clears the output format to scratch
		*        Sets all fields and output features
		-<c>     Exclude the column <c>
		d        Dirs column
		e        Efficiency column
		f        Files column
		i        Disk Info header
		p        Path column (and filter)
		t        sTreams column
		u        Usage column
		x[:sort] eXtension usage table (sort same as /x above)
	<filter>
			   Any globbing pattern. i.e.: "*.gif" or "haywire?.htm*"
    ---------------------------

    Switches:

      c       Report diskusage in clusters instead of bytes.
              Reported sizes will be allocated clusters instead of allocated 
              bytes, sort of like UNIX' du command.


      d       Do not count directories as an allocated cluster.
              This causes any directory to be excluded from the size
              calculation. This can be useful sometimes. I have yet to gotten
              my hands on any information about how NTFS allocates directories
              (files), so this flag is default enabled if scanning NTFS disks 
              (it will result in a more accurate total result).


      f[:N]   Fake clustersize to N bytes.
              Normally Zdu determines the clustersize of the scanned disk
              automatically. This can be overridden with this flag. This
              could be useful if comparing a directory on two different
              computers. The specified cluster size [N] will be truncated
              to the nearest, lower, power of 2. Entering a 'k' after the
              number will treat it as kilobytes instead of bytes, e.g. 
              "/f:32k" to fake the size to 32 kilobytes.


      k       Report diskusage in kilo- bytes or clusters, similar to the
              "-k" switch on some versions of "du".


      q       "Quick" mode:
              If this switch is given Zdu will only return the total usage
              of the specified path plus the available info about the disk.


      r       Print recursively the usage. In a given directory tree, the
              innermost directory usage will be output first, then its parent,
              and then that directory's parent, and so on. It takes a bit of
              getting used to, to understand what the output means.


      s       Silent mode. Will only print the bottom line, i.e. the total 
              usage of the scanned path.


    x[:sort]  Show also usage based on filename eXtension also. Specifying
              this switch Zdu will output a table with extension after the
              normal report (with dirs, files & usage).

              The table can be sorted in three ways: by extension (default,
              descending), by number of files (ascending) and by usage 
              (ascending). This is done by supplying the sorting char after
              the colon, e.g. "/x:n" to sort by number of files. The sorting
              order can not be controlled at this point. Extensions longer
              than 12 chars will be cut in the printout indicated by ">>"
              after the extension.


      F:<fmt> Modifies the output from Zdu.
              <fmt> can be one or more of the following: 
              0 (clear all), * (set all), - (exclude feature), 
              d (directories column), f (files column), u (usage), p (path),
              i (disk info), s (streams) and x[:sort] (extensions table).
              By specifying any of the column fields or feature, it will be 
              added, unless the '-' preceeds it, e.g. enter /F:t and Zdu 
              will add the 'S' column (streams) to the output, or entering
              /F:-d will remove the 'Dirs' column from the output.
              By default Zdu outputs Dirs, Files, Usage, Efficiency and 
              Path columns. If all features are cleared (with '0' or - for 
              all), the deafault output will be used.


    NOTE: The switches are now CASE-sensitive.

    Filter:

      Zdu uses a normal globbing string matcher method. Therefore any valid 
      glob-pattern is viable, for example:

        *.txt     : filenames ending with ".txt"
        *one*     : filenames that contains "one"
        file?.txt : files with names like "files,txt", "file1.txt" etc.


7.  KNOWN BUGS/FLAWS, REPORTING

    - NTFS directories are not handled correctly, but in large should give an 
      correct result.

    - Switches on the commandline can not be grouped 
      (i.e. '/kc' must be typed as '/k /c').

    If you have found any bugs please e-mail me immediately, I might not have
    found it yet 8) Or if you just like to give me some suggestions, 
    or maybe some flames?

    e-mail: haywire@fatalunity.com


8.  VARIOUS

    During development of Zdu the following music was listened to: 
    (in no particular order)

      Helloween: Better Than Raw
      ZZ-Top: The very best of
      Meshugga: Destroy Erase Improve
      Meshugga: Contradictions Collapse & None
      Anthrax: The threat is real
      Anthrax: Attack of the killer B's
      Sugar Ray: Lemonade and Brownies
      Pantera: The great southern trendkill
      Pantera: Vulgar display of power 
      Enya: The celts
      Rammstein: Sehnsucht
      Rage Against the Machine: Evil Empire
      2 Unlimited: Hits unlimited
      S.O.D.: Bigger than the devil
      Skunk Anansie: Post orgasmic chill

    And, mind you, these are no mp3 crap, it's the real deal, well...
    CD anyway.


9.  DEVELOPMENT

    Info     : C-source   : ~46 kbytes (in ~2000 rows) (mostly plan C)
               Exe-file   : ~56 kbytes
               Build time : ~8 sec

    Software : Windows NT 4.0
               MS Visual C++ 5.0 & 6.0

    Hardware : PII-400 256Mb RAM

    Docs     : Notepad      (accept no limitations!)
                


10. AUTHOR

    This little piece of software was written by Andr Jonsson. I'm from 
    Skellefte, Sweden. Visit my homepage at: http://haywire.fatalunity.com
    All new revisions of my Zdu will be downloadable from there (after
    following a link). At present only Zdu is available for download.

    Initial programming of Zdu started way back in early 1995, because at the
    time there were no diskusage programs at all available for the DOS 
    "platform" (that I knew of). As for release 2, the programming of the
    Win32 next-generation reincarnation began in the dawn of 1998, for
    an unknown reason :-)

    I have previously also released a program called Zap (a DOS program), 
    which is a file/directory removing utility. It is publically available
    on SimTel mirrors, and elsewhere. Download it will ya! 
    The archive is called AJZAP266.ZIP.

    e-mail: haywire@fatalunity.com        (no, it's not clickable)
    


11. SPECIAL THANKS

    Thanks goes to the following:

    - Data Ductus AB       Employer
    - Andreas Wiklund      Programmer of the crackwiz string matching routine,
                           feature suggestions, and RL-tester.
                           


12. FUTURE IDEAS

    What Zdu will hopefully do in the near future:

    - Add option to follow links (Windows ones and those made by cygwin 'ln').
    - Make it possible to control the order of the output columns.
    - Filter collected files on more criterias other than 
      filename, e.g. create date, change date, attributes etc.
    - Make it possible to report on a basis of a specified user/domain owner
      (NTFS only).
    - Add HTML versions of this text file (zdu.txt) and the ChangeLog.txt.


    What Zdu will NOT do/have:

    - A GUI (there are so many (bad) GUIs already), and it serves no purpouse.
    - DLL files spread around the system. (although it already uses some
      system DLL:s under NT)
    - Suggestions? Mail me!  (feedback is of the essence!)


13. PROGRAM HISTORY

    ** Section moved to CHANGELOG.TXT


-----------------------------------------------------------------------------


  Laws of Computer Programming:

    (1) Any given program, when running, is obsolete.
    (2) Any given program costs more and takes longer.
    (3) If a program is useful, it will have to be changed.
    (4) If a program is useless, it will have to be documented.
    (5) Any given program will expand to fill all available memory.
    (6) The value of a program is porportional to the
        weight of its output.
    (7) Program complexity grows until it exceeds the capability of the
        programmer who must maintain it.
    (8) Make it possible for programmers to write in English and you
        will find the programmers cannot write in English.




                                  DON'T PANIC





Wow! You read all the way down here! If you meet someone else who managed to
do the same, you better start a club or something because you are some rare
people! :-)