Dec 252017
 
A DOS utility for showing how much space selected files in a directory/sub- directory occupies. Complete Turbo C source included.
File MADSZ.ZIP from The Programmer’s Corner in
Category File Managers
A DOS utility for showing how much space selected files in a directory/sub- directory occupies. Complete Turbo C source included.
File Name File Size Zip Size Zip Type
SZ.C 17367 5682 deflated
SZ.COM 4066 2914 deflated
SZ.DOC 6426 2494 deflated

Download File MADSZ.ZIP Here

Contents of the SZ.DOC file



SZ.COM by Mark Adler Pasadena, CA 1988.

SZ will determine the amount of space taken up by all the files in a
directory and its subdirectories, including system and hidden files.
The command:

sz

will give a message like:

bytes/actual/floppy = 391670/485376/414208 in 85 files.

which is information about the files in the current directory and its
subdirectories on the current drive. The first number is the sum of the
byte counts for all the files. The second number is the number of bytes
the files actually occupy on the drive they are on. The third number is
the number of bytes the files would take up on a floppy drive with a
blocking of 512 bytes. The last number is the number of files included
in those totals. The space taken by the directory entries in the
subdirectories is not computed or included. DOS does not provide this
information.

SZ will take arguments for drives and directories other than the current
one. For example:

sz a:\sys

Arguments may contain wild card characters, but note that the ambiguous
name only applies to the level in the path where it appears:

sz \dos\*.com

Multiple arguments can be used and the result will be the sum for all
the files:

sz \bin \bat \dos

SZ can list the files that it finds and produce subtotals for the
directories it processes. The option for this is "/L":

sz/l \dos

might produce the output:

directory \DOS\*.*
COMMAND.COM ANSI.SYS COUNTRY.SYS DISPLAY.SYS DRIVER.SYS
FASTOPEN.EXE FDISK.COM KEYB.COM KEYBOARD.SYS MODE.COM
NLSFUNC.EXE PRINTER.SYS REPLACE.EXE SYS.COM VDISK.SYS
XCOPY.EXE EGA.CPI LCD.CPI 4201.CPI 5202.CPI
APPEND.EXE ASSIGN.COM ATTRIB.EXE BACKUP.COM BASIC.COM
BASICA.COM CHKDSK.COM COMP.COM DEBUG.COM DISKCOMP.COM
DISKCOPY.COM EDLIN.COM FIND.EXE GRAFTABL.COM GRAPHICS.COM
JOIN.EXE LABEL.COM MORE.COM PRINT.COM RECOVER.COM
RESTORE.COM SHARE.EXE SORT.EXE SUBST.EXE TREE.COM
BASIC.PIF BASICA.PIF MORTGAGE.BAS EXE2BIN.EXE LIB.EXE
LINK.EXE VDISK.ASM
directory \DOS\FORMAT\*.*
FORMAT.COM SELECT.COM
bytes/actual/floppy = 15779/18432/16384 in 2 files.
bytes/actual/floppy = 671088/724992/685056 in 54 files.

Note the indentation of subdirectories.

SZ can try to find matches for a filename in all the directories. The
option is "/F". For example:

sz/fl \*.tex

will find and display all *.tex files anywhere on the current drive.

SZ will take options that are preceded by a slash (/). The command line
is read from left to right, processing options and file/path names as
they appear. However, options that are appended to a file/path name
take effect before that name is processed. For example, this command
would do the same thing as "sz/l \dos":

sz \dos/l

The options are:

/L - Turn on listing.
/Q - Quiet---turn off listing (default).
/N - Do not include subdirectories in total or listing.
/S - Include subdirectories (default).
/I - Ignore hidden and system files.
/H - Include hidden and system files (default).
/W - Weird---exclude "typical" files, where atypical files are
ones that are hidden, system, or read-only.
/T - Include typical files (default).
/B - Exclude backed up files.
/U - Include backed up files (default).
/F - Find a file---use the last name in to match in subdirs also.
/A - All files---use *.* in the subdirs (default).
/nnn - Change the floppy blocking factor to nnn (default is 512).
/? - Display version number and list of options.

Options can be combined with or without additional slashes. For
example, these commands do the same thing:

sz /l /b \
sz /l/b \
sz/lb \
sz \/lb

What those commands do is list all the files that have not been backed
up yet and what subdirectories they are in. Examples of useful
combinations of options are:

sz /l \ List all files on the current drive.
sz /fl \name Find and list all files on the current drive
that match 'name'.
sz /lb \ List all files on the current drive that need to
be backed up.
sz /wl a: List all atypical files on A:
sz /wil \ List all read-only files on current drive
sz /nl List the files in the current directory

More complicated combinations are possible, of course. For example:

sz /n128bl d: /s \ /q a:

which lists the files that need to be backed only from the current
directory in D:, lists all the files that need to be backed on the
current drive, and adds the sizes for the files in the current directory
on A: and its subdirectories, without listing those files. For all of
this, the floppy blocking factor is 128 instead of 512. Note that
options remain in effect on a command line until contradicted. For
example, the /n turns off subdirectory searches for d:, but the /s turns
it back on again for \ and A:. The /L turns on listing for D: and \,
but the /Q turns off listing for A:. The /B and /128 is in effect for
all three.

Note that the commands:

sz \/l
sz \ /l

are different. The first lists all the files on the current drive. The
second only computes the space for all files on the current drive and
the /L has no effect. It is an option left "hungry" for a name to
operate on, since the command line is processed from left to right. The
exception to this is if no names appear on the command line, in which
case the default name "*.*" is appended to the end of the command line.

The last line displayed by SZ is always the grand total for all files
counted, whether it is indented or not.

If list is on (/L) and the directory level becomes more that 10 deep,
then the listing is not done for that level (or deeper levels). The
message "(level too deep---no files will be listed)" will be displayed
to indicate this.

Version history -

1.0 29 May 1988 First public version
1.1 4 June 1988 Added /F, /A

Feel free to send any problems with or comments on SZ to:

Mark Adler
P.O. Box 60998
Pasadena, CA 91106



 December 25, 2017  Add comments

Leave a Reply