Average File Size v1.04 Public Domain Utility Written By Robert B. Clark ClarkWehyr Enterprises, Inc. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ AVGFSIZE is a simple little utility that scans a disk drive and reports some basic statistics about its file system: o Bytes used o Bytes available o Allocation unit (cluster) size o Number of files (includes system, hidden) o Number of directories (includes system, hidden) Oh yes, it also reports the average file size +/- the sample population standard deviation. (Hence the name--AVGFSIZE) :-) In addition to the information just mentioned, AVGFSIZE presents a table listing various common allocation unit sizes and the amount of wasted disk space on average that would result from using that particular cluster size. QUICKSTART: ~~~~~~~~~~~ Unzip the AVGFS104.ZIP archive and run AVGFSIZE.EXE. The syntax for this utility may be viewed by typing AVGFSIZE /? Usage: AVGFSIZE [drive:] Reports the average size of all files on drive [drive:] [drive:] defaults to the current drive. AVGFSIZE works on any valid DOS drive--local, remote, CD-ROMs, diskette drives, ad inf. The program may be run from within a Win v3.x or Win95 DOS box or from the good ol' DOS command line shell. EXAMPLE OUTPUT: ~~~~~~~~~~~~~~~ Here is an example of the output generated by AVGFSIZE on a PC using the US code page (AVGFSIZE recognizes and uses the appropriate country punctuation based upon the active code page): AVGFSIZE v1.04 Written 25 July 1996 by Robert B. Clark . Donated to the public domain. Gathering file and directory information for drive F: ... Disk space used : 713,817,919 bytes Disk space available : 249,196,544 bytes Allocation unit size : 4,096 bytes (4K) Directory count : 846 directories User file count : 13,332 files Total file count : 14,178 files ---------------------------------------------------- AVERAGE FILE SIZE : 53,541 ñ 3 bytes (ñ 0.0%) Page 1 Block Size Blocks/Avg File Slack Space/Avg File Wasted Space ======================================================================= 512 bytes 104.572 219 bytes 2,919,708 bytes 1K 52.286 731 bytes 9,745,692 bytes 2K 26.143 1,755 bytes 23,397,660 bytes 4K 13.072 3,803 bytes 50,701,596 bytes * 8K 6.536 3,803 bytes 50,701,596 bytes 16K 3.268 11,995 bytes 159,917,340 bytes 32K 1.634 11,995 bytes 159,917,340 bytes 64K 0.817 11,995 bytes 159,917,340 bytes The files on drive F: are, on average, 53,541 ñ 3 bytes in length. The drive has an allocation unit size of 4K, which according to the table means that an average file on drive F: would fill thirteen full clusters and approximately 7% of the fourteenth. The remaining 93% of that fourteenth cluster is referred to as "slack space" and is not usable--DOS as a general rule does not sub-allocate disk clusters. This means that on average, 3,803 bytes will be wasted for every 53K file written to disk. Overall, 50Mb of space on the drive is currently wasted due to slack space. Further examination of the table shows that increasing the cluster size from 4K to 8K results in approximately the same amount of slack space, but the number of clusters required to store an average file have been cut in half. This should garner a small disk file I/O performance boost, all else being equal (which it hardly ever is). DEVELOPMENT: ~~~~~~~~~~~~ AVGFSIZE was written in C using Borland's Turbo C++ v3.0 compiler and was tested on a P5-100Mhz, 16Mb, 1.2Gb workstation on a Novell NetWare v3.11 LAN. The source code is included in the archive; feel free to modify and/or redistribute the program to your heart's content. Just leave my name in there, if you please. :-) This program is hereby dedicated to the public domain. MANIFEST: ~~~~~~~~~ avgfsize c 9,728 07-25-96 1:04a C source code for AVGFSIZE avgfsize doc 5,311 07-25-96 1:04a This file avgfsize exe 30,370 07-25-96 1:04a AVGFSIZE executable avgfsize h 3,456 07-25-96 1:04a C header file for AVGFSIZE file_id diz 332 07-25-96 1:04a Archive description plurals h 789 07-06-96 1:00a Pluralization macros strutils h 2,915 07-24-96 1:02a Support header for strutils.obj strutils obj 1,304 07-24-96 1:02a Object file used w/avgfsize.c To recompile the program, place all of the above source files in the same directory and type tcc avgfsize.c strutils.obj See the source files for additional notes and comments. ### Page 2