DIRTOTAL.DOC 1 Revised: 12-22-96 The DIRTOTAL.EXE program is another directory-listing program. It produces a text file with the results of your search and is primarily designed for inventory purposes. It includes these features: * Can search an entire drive or part of a drive. * Can search multiple drives. * Can look for individual files or all files. * Can select based on attributes, date, or size. * Can extract information for archive files (ZIP, LZH, etc). * Can look for duplicate file names. * Can produce a couple of different report formats; see the "Syntax" section for examples. * Works on a CD-ROM and network drives. * The date format shown is based on your country setting. * Can be used to produce the directory information as a tree with subdirectory counts and totals. * Can be used to show the "top x" files on the disc by either size (for example, largest files) or date (for example, most recent files). DIRTOTAL goes through all directories on a given drive (or on multiple drives) and writes out the names and space used for all files on that drive. You will also see directory totals and such. (You can suppress the individual file names listing if you want.) Alternatively, you can have the utility restrict the search to just those files within a given subdirectory and its child subdirectories. For example, if you had a directory structure like this: +-- DOS +-- TC -+-- KERMIT | +-- BANYAN +-- 123 If you pass in just the drive designation, you will get files in all subdirectories. If you pass in "C:\TC", you'll get all files in C:\TC, C:\TC\KERMIT, and C:\TC\BANYAN. DIRTOTAL then tries to total up the space used by subdirectory as well as for the entire disk. The routine also presents subtotals for directories with children. For networked and CD-ROM discs, it will typically present the wrong results when it comes to total disk space and total free space but the file and directory totals will all be correct. DIRTOTAL creates an output file in the default directory on the C: drive called "DRIVE#s.DIR" (where "s" is the letter of the drive you scanned) which contains the file listings and total size reports. If you restrict the output to a specific subdirectory and its children, the file name created will be called "DRIVE#sx.DIR", where "x" is the first letter of the restriction ("DIRTOTAL C:\TC" would create a file called "DRIVE#CT.DIR"). If you ask for more than one drive at a time (for example, "DIRTOTAL C: D: E:"), the file name will put the number of drives scanned in place of the drive letter (so "DIRTOTAL C: D: E: \TC" would create a file called "DRIVE#3T.DIR"). DIRTOTAL.DOC 2 Revised: 12-22-96 The DIRTOTAL.EXE program was originally written in order to find out how much space the various files took on a CD-ROM disc. However, it works fine on large disk drives and network drives. WIN95 AND WINNT NOTICE: As with most DOS-based utilities, this program doesn't understand the weird subdirectories, long filenames, invalid characters that are possible under Windows 95 and Windows/NT. If you're in non-compatible file mode, the program may not work correctly. Note: When examining the output report, you may find some weirdly-named eight-character file names (typically beginning with "A" or "B") in your root directory. Typically, these will show up if you run DIRTOTAL on your C drive. These files are temporary ISAM files created by the routine. They are deleted once the program is run. Specifying parameters: Parameters for this program can be set in the following ways. The last setting encountered always wins: - Read from an *.INI file (see BRUCEINI.DOC file), - Through the use of an environmental variable (SET DIRTOTAL=whatever), or - From the command line (see "Syntax" below) Syntax: DIRTOTAL [ { drive: | filepath | filespec }... ] [ /NORMAL | /WIDE | /THIN | /SPLIT ] [ /DUPS ] [ /CHILD ] [ /NL ] [ /-HEADERS ] [ /-FOOTERS ] [ /CLUSTERS ] [ /TREE ] [ /A ] [ /S { GT | GE | LT | LE | EQ | NE } value ] [ /D { GT | GE | LT | LE | EQ | NE } date ] [ /ATTR=attribs ] [ /Frptfile ] [ /Z | /-Z ] [ /Ox | /O-x ] [ /TOP=n ] [ /-SUB1 ] [ /-SUB2 ] [ /+DIR | /-DIR ] [ /n ] [ /BEEP ] [ /Tpath ] [ /Q ] [ /Iinitfile | /-I ] [ /? ] where: "drive:" is the letter of the drive you want to scan ("C:", "D:", "L:", et cetera). If no drive is specified, the routine presumes you want all files from your default drive. You can specify multiple drives if you want. "filepath" retricts the listing to files that are off a particular subdirectory. Make sure you specify the "\" at the end of the path. For example, "DIRTOTAL C:\VBDOS\" "filespec" restricts the listing to files that meet some file specification. The restriction can include wildcards. For example, "DIRTOTAL C:\*.BAS". Multiple filespec or drive specifications are fine. (One quirk: If you specify a filespec, the program will not show parent subdirectory totals for parent subdirectories that are empty.) DIRTOTAL.DOC 3 Revised: 12-22-96 "/NORMAL" is typically the default report format. It produces a report which is 80-characters wide and has the complete file name listed on each line like this: C:\ACD.IDX 09/26/93 00:34:50 575 a C:\AUTOEXEC.BAT 08/20/93 00:08:42 845 a C:\BOOT.CPS 05/06/93 18:56:28 1,024h C:\CHKLIST.CPS 05/20/93 22:23:06 135 a C:\CMOS.CPS 05/06/93 18:56:28 48 Note the last four characters show any special attributes set for the file: a = archive bit set (the file hasn't been backed up yet) h = hidden bit set s = system file bit set r = read-only file bit set "/WIDE" produces a 126-character wide report with all of the information in fixed columns. This is fine for compressed printing or subsequent processing by some other program. The field positions are as follows: cols 1- 65 path (including drive) 67- 78 filename (or ZIP name) 80- 91 ZIP member name (if any) 93-100 file creation date 102-109 file creation time 111-121 file size in bytes 123-126 attributes This option invokes /Z although you can specify /-Z if you want to override it. This option is primarily designed for people who need a complete catalog of everything in a CD-ROM and programs like CATDISK choke if you exceed 4000 files per disc. "/THIN" produces a smaller report. The directory name is printed separately from the file name. It automatically invokes the /CHILD option and produces a report similar to this: C:\ ACD.IDX 09/26/93 00:34:50 575 a AUTOEXEC.BAT 08/20/93 00:08:42 845 a BOOT.CPS 05/06/93 18:56:28 1,024 h CHKLIST.CPS 05/20/93 22:23:06 135 a "/SPLIT" creates the results file with the filename in a fixed field within the file. If the subdirectory name doesn't fit, it's truncated. The /WIDE option is better if your subdirectory names exceed 35 characters (if /Z is not used) or 22 characters (if /Z is used) unless you're particular about having 80-character or less reports. A sample of the output with /Z: D:\CLONE22\ PB22OBJ.LZH ADDMATI.OBJ 05/01/93 11:14:58 124 D:\CLONE22\ PB22OBJ.LZH ADDMATL.OBJ 05/01/93 11:14:58 132 D:\CLONE22\ PB22OBJ.LZH ALLEXTME.OBJ 05/01/93 11:14:58 110 D:\CLONE22\ PB22OBJ.LZH ALTKEY.OBJ 05/01/93 11:11:54 1,282 DIRTOTAL.DOC 4 Revised: 12-22-96 "/DUPS" produces a report which shows all files with the same file names on your disk. By default, it produces a report that's a modified version of the /THIN report: CHKLIST.CPS C:\ 05/20/93 22:23:06 135 a C:\DOS\ 06/27/93 21:17:12 999 a C:\TC\KERMIT\ 05/06/93 19:02:22 108 a C:\TC\TELIX\ 07/10/93 10:28:22 135 a /DUPS is incompatible with the /SUB, /CHILD, or /NL options. If you want to override the default /THIN report format using /DUPS, you have to specify the report format after the /DUPS option (for example, "DIRTOTAL /DUPS /NORMAL"), not before ("DIRTOTAL /NORMAL /DUPS" will ignore the /NORMAL option). "/-DUPS" is the reverse of "/DUPS". "/CHILD" produces a listing with directory subtotals intermixed with the regular file names. This is useful for visual effect but a problem if you use the file as input into something else. The option is automatically invoked for /THIN reports. A sample: C:\FATE\ ATLANTIS.INI 08/20/93 23:17:56 229 a SAVEGAME.001 08/20/93 23:30:54 45,334 a Total 2 files 45,563 bytes in C:\FATE\ "/NL" eliminates the listing of individual file names and sizes and simply gives you the subdirectory totals. This option overrides the /Z specification. This option is also incompatible with the /DUPS option. "/-HEADERS" skips writing out the first couple of introductory lines in the output file which describe what options were used and such. This is mainly of use if you plan to process the output file electronically. "/HEADERS" is the opposite of "/-HEADERS" and is initially the default. "/-FOOTERS" skips writing out the summary information at the end of the output file. This includes the directory totals and such. This is mainly of use if you plan to process the output file electronically. "/FOOTERS" is the opposite of "/-FOOTERS" and is initially the default. "/CLUSTERS" says to show file sizes in terms of cluster sizes (space allocated) instead of the normal bytes used. DOS typically shows things in terms of bytes used. Note that clusters aren't all that relevant on compressed drives or in the contents of compressed files. "/-CLUSTERS" says to show file sizes in terms of bytes used. This is how DOS normally shows things. This is initially the default. DIRTOTAL.DOC 5 Revised: 12-22-96 "/TREE" says that the subdirectory totals are to be presented in a tree-like fashion. For example: 42 586,673 C:\ 31 209,465 ÃÄ BANSAS 21 116,795 ³ ÃÄ ARCHIVE 1 1,146 ³ ÀÄ SASUSER 91 21,541 ÃÄ BAT 2 152,494 ÃÄ COMPRESS 97 2,984,997 ÃÄ DOS The actual characters used is dependent on the /A setting (below). The initial default is /-TREE (no trees) and /-A (use graphic characters like the above instead of text characters). "/-TREE" shows the subdirectory totals in the simpler format. For example: Dir C:\ 42 586,673 Dir C:\BANSAS 31 209,465 Dir C:\BANSAS\ARCHIVE 21 116,795 Dir C:\BANSAS\SASUSER 1 1,146 Dir C:\BAT 91 21,541 Dir C:\COMPRESS 2 152,494 Dir C:\DOS 97 2,984,997 "/A", when used with the /TREE parameter, produces the tree using DOS text characters instead of graphics characters. The initial default is "/-A". For example: 42 585,126 C:\ 31 209,465 +- BANSAS 21 116,795 | +- ARCHIVE 1 1,146 | +- SASUSER 91 21,541 +- BAT 2 152,494 +- COMPRESS 97 2,984,997 +- DOS "/-A", when used with the /TREE parameter, produces the tree using graphics characters. This is initially the default and is shown above. DIRTOTAL.DOC 6 Revised: 12-22-96 "/S xx value" says you want to limit the list of individual files to those which meet a certain size requirement. Due to DOS's redirection commands, relations like ">" and "<" don't work so you have to use the two-letter abbreviations: GT greater than > GE greater than or equal to >= LT less than < LE less than or equal to <= EQ equal to = NE not equal to <> Having said that, the only two you're likely to use are GT and GE. The "value" is the size value you want tested for. So "SPACE GT 1000000" would find all individual files with a filesize greater than one million bytes. Note that the directory total information will still indicate all files, not just the ones which meet your size limitation request. "/D xx date" says to show only those files created before or after a given date. As before, you have to use GT, GE, LT, LE, EQ, and NE for the relational operator. "/D GE 10/01/91" would show only those files created on or after October 1, 1991. The format for the date is determined by your system settings (it might be "/D GE 10.01.91" in France). "/ATTR=attribs" allows you to specify a combination of attributes that you want considered. You can specify any combination of R (read-only), H (hidden), S (system), or A (archive bit). Precede any character(s) with "-" to exclude instead of include. Note that the inclusions are "OR" conditions; if a file meets any of the attributes in the inclusion, it is allowed (/ATTR=H will retrieve any file with the hidden attribute set, even files that also have the system attribute set). Exclusions are also subject to "OR" conditions. Initially defaults to /ATTR= (get everything). "/Frptfile" says to write the results to a given file name. By default, the results with go to C:DRIVE#ds.DIR, where "d" is the drive letter and "s" is the first letter of any path restriction used. So "DIRTOTAL C:\*.*" would default to /FC:DRIVE#C.DIR. You can say /FSCRN: if you want. "DIRTOTAL C: /FSCRN: /NL" is useful. "/Z" shows the contents of any ZIP, ARC, ARJ, LZH, PAK, or ZOO file too. Is automatically invoked if /WIDE is specified. "/-Z" reverses /Z and is the default unless /WIDE is specified. "/Ox" and "/O-x" allow you to specify the display order for the files. "x" can be one of the following: N = file name (exclusive of directory name) E = file extension D = file date and time (earliest date first) S = file size of the original (non-compressed) file (smallest first) O = order by directory, then file name If you precede the "x" with a dash ("-"), the sort will be done in reverse order. Typically defaults to /OO. Note that the /THIN option makes the directory name be the primary sorting index. DIRTOTAL.DOC 7 Revised: 12-22-96 "/TOP=n" confines the listing of files to the top "n" items. Can only be used with /OD, /O-D, /OS, or /O-S. Cannot be used with /NL. The results shown for /SUB1 and /SUB2 are not affected by this option. Initially defaults to "/-TOP" which is the same thing as "/TOP=0". "/-TOP" gives you all files, not just the top "n" ones. This is initially the default. "/SUB1" gives you subdirectory totals (how many bytes/files are in this subdirectory). This option is only relevant if the /THIN option isn't used; /THIN automatically interweaves subdirectory totals within the listing. This is typically the default. "/-SUB1" suppresses the printing of the individual subdirectory subtotals. One thing you might want to do with this parameter is something like this: DIRTOTAL /NL /1 /-SUB1 which will give you just the total for each primary-level subdirectory on the default drive including information about all of the subdirectories included in those primary-level subdirectories. "/SUB2" gives you cumulative subdirectory subtotals (including how many files and bytes are in subdirectories this level and below). This is typically the default. "/-SUB2" suppresses the printing of cumulative subdirectory subtotals. "/+DIR" includes directories in the file count summary at the end of the report. This corresponds to what DOS shows when you do a DIR and is apparently useful on a Novell network. The default is /-DIR. "/-DIR" drops directories from the file count summary. This is the default. "/n" confines the subdirectory total list to only those entries at the nth level subdirectory and above. "/n" can be any single-digit value between 0 (only those files in the root) and 9 (typically all of them). For example, "/1" would only show the directories off the root, not the subdirectories off of these directories. Note that in terms of the directory total information printed using /SUB1 or /SUB2, the "/n" parameter affects which directories prints. For /SUB1, only information up to the nth level will be shown. For /SUB2, the cummulative totals will reflect all subdirectories below each level (as before), but the individual subdirectories themselves will not be printed out. A useful way to find out major disk pigs by major subdirectory (when you don't really care about the individual files in each) is to say: DIRTOTAL /NL /1 /-SUB1 /SUB2 "/BEEP" gives you a beep when the program finishes. Initially defaults to "/-BEEP". "/-BEEP" does not give a tone when the program finishes. This is initially the default. DIRTOTAL.DOC 8 Revised: 12-22-96 "/Tpath" specifies where to write the temporary ISAM files that the routine needs. ISAM data bases are used to store and sort the file names. ISAM files cannot be created reliably on certain types of drives. Examples are "/TC:" and "/TC:\TEMP". If not specified, the routine writes to the following in sequence: - the value of any TEMP, then TMP, environmental variable - C:\TEMP - C:\ "/MONO" (or "/-COLOR") does not try to override screen colors. Initially defaults to "/COLOR". "/COLOR" (or "/-MONO") allows screen colors to be overridden. This is initially the default. "/Q" turns off the file-by-file status reporting that the routine does. "/Iinitfile" says to read an initialization file with the file name "initfile". The file specification *must* contain a period. Initfiles are described in the BRUCEINI.DOC file. Initially defaults to "/IDIRTOTAL.INI". "/-I" (or "/INULL") says to skip loading the initialization file. "/?" or "/HELP" or "HELP" shows you the syntax for the command. Return codes: DIRTOTAL returns the following ERRORLEVEL codes: 0 = no problems 250 = operation aborted by pressing Escape 253 = no files found or invalid drive 254 = could not find a decent temporary output subdirectory 255 = syntax problems, or /? requested DIRTOTAL.DOC 9 Revised: 12-22-96 Author: This program was written by Bruce Guthrie of Wayne Software. It is free for use and redistribution provided relevant documentation is kept with the program, no changes are made to the program or documentation, and it is not bundled with commercial programs or charged for separately. People who need to bundle it in for-sale packages must pay a $50 registration fee to "Wayne Software" at the following address. Additional information about this and other Wayne Software programs can be found in the file BRUCE.DOC which should be included in the original ZIP file. The recent change history for this and the other programs is provided in the HISTORY.ymm file which should be in the same ZIP file where "y" is replaced by the last digit of the year and "mm" is the two digit month of the release; HISTORY.611 came out in November 1996. This same naming convention is used in naming the ZIP file (DIRTOymm.ZIP) that this program was included in. Comments and suggestions can also be sent to: Bruce Guthrie Wayne Software 113 Sheffield St. Silver Spring, MD 20910 fax: (301) 588-8986 e-mail: bguthrie@nmaa.org http://hjs.geol.uib.no/guthrie/ Please provide an Internet e-mail address on all correspondence.