home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Format 10
/
10-1.iso
/
SPDMAP
/
SM.DOC
< prev
Wrap
Text File
|
1991-12-20
|
17KB
|
343 lines
Space Map
Disk Space Mapping Program
Version 1.0
Ben Smith
110 S. Gardenia
Celeste, TX 75423
SCENARIO 1: You're a network administrator. One morning, to your
horror, you discover that one of your users has eaten all but 500K of
the space on the system volume! Quick, which user is the culprit?
SCENARIO 2: You're installing that new Windows application that takes
only about fifteen meg of disk. You have six. Quick, which directory
can you zap and free up enough space?
SCENARIO 3: You're about to do a backup, and would like list of
EVERY file on your disk to compare to your backup copy should the
worst happen. Quick, how do you get it?
With SPACE MAP, it's easy! Space Map is the utility you need to
answer simple questions like:
How big is that application, with all its directories?
What can I clean off my disk to free up space?
Hey! Where'd all my disk go?!
BUT WHY? Because no utility I use could do this! I own Lotus
Magellan, PC Tools 7.1 and several other general purpose utility
packages...NONE of them could tell me how much space was in use in a
single directory and all of its child directories! Even the several
dozen shareware offerings couldn't do this simple chore (although I'd
be happy to hear from anyone who knows of a product that does this).
LATE NOTE - 12/20/91 I just downloaded a copy of CAT Systems' DIGGER
utility. It does much the same job as this program, although it has a
different "flavor." DIGGER (and the other parts of the Lion
Utilities) is a good program which presents another take on fixing
this problem.
DISTRIBUTION: Space Map is being distributed as freeware. You are
free to use Space Map on as many computers as you like, for as long as
you like. You may give copies away to friends, customers, business
associates, or anyone else. If you are a shareware distributor, you
may include Space Map in your collection, so long as your disks sell
for less than $5.00 each, and you make it clear to your customers
that they are buying the physical diskette, and that the program
itself is free.
You may not, however, sell the Space Map program itself. The program,
this document file, and any other files which may be distributed in
the Space Map archive file are copyrighted material (c) 1991 Ben
Smith. Permission to copy is granted so long as the above conditions
are met.
DISCLAIMER: While I have taken every reasonable precaution to ensure
that Space Map is safe and effective when used as directed, because of
the diversity of software and hardware in common use I cannot be
responsible for any actual or consequential damages caused by this
program to your computer or the data stored in it. You use this
program strictly at your own risk. By running the program, you
indicate your assent to this limitation of liability.
WHAT'S IN THE ARCHIVE?
The archive (or disk, if you obtained the program from a shareware
distributor) contains the following files:
SM.COM The Space Map program
SM.DOC The documentation file you're reading now
READ.ME Last minute notes, release updates
HOW TO USE IT: Copy the SM.COM file to some directory on your PATH
(if you're not sure what a PATH is, ask someone). On my computer, I
have a UTIL directory that includes all of my one-program utilities
(like LIST and PKZIP). The syntax of the command to invoke Space Map
is:
SM [pathname] [/T] [/F] [/Dnn]
All parameters to the SM command are optional. When the program is
invoked, it will always descend through EVERY subdirectory under
[pathname]. As it goes, it will add up the sizes of all of the files
it finds. As it backs out of each directory, it can display the total
of the sizes of all files in the directories it's found along the way.
Three parameters are used to tell Space Map how to display the
results:
/T - Print the time and date of each file and directory
/F - Display every file as well as directories
/Dnn - Display only the first nn directory levels
The same information can be obtained by typing SM/H or SM/?. You will
then see the following summary screen:
╔════════════════════════════════════════════════════════════════════╗
║ Space Map Version 1.0 ║
║ Copyright (c) 1991, Ben Smith ║
║ ║
║ Usage: SM [directory spec] [/T] [/F] [/Dnn] ║
║ /T - Display file time and date instead of allocated space ║
║ /F - Display files in each directory ║
║ /Dnn - Display only nn levels of directory depth ║
║ /? or /H - Display this help text ║
╚════════════════════════════════════════════════════════════════════╝
Just by typing SM in your current directory, you'll see a display
something like this:
╔══════════════════════════════════════════════════════════════════╗
║ Space map of C:\TEMP ║
║ This directory:.......136,577 bytes.......159,744 allocated. ║
║ ├─OVERVIEW:.............767,171 bytes.......774,144 allocated. ║
║ │ ├─EMPTY:.....................no files. ║
║ │ ├─NONEMPTY:..............63,275 bytes........65,536 allocated. ║
║ ├─OVERVIEW..............830,446 bytes.......839,680 allocated. ║
║ ├─EMPTY:.....................no files. ║
║ │ ├─NOTRLY:....................no files. ║
║ ├─EMPTY......................no files. ║
║ Directory total:......967,023 bytes.......999,424 allocated. ║
╚══════════════════════════════════════════════════════════════════╝
The first line tells you what directory is being mapped. In this
case, it is the TEMP directory in the root of the C: disk drive. The
second line tells you how much space is being taken up by files that
are in this SPECIFIC (C:\TEMP) directory; that is, files in
subdirectories are not included. The first number (in this case,
136,577) is the total of all bytes reported as being used by DOS. The
second number (in this case, 159,744) is the amount of space which has
ACTUALLY been allocated to these files by DOS. This may require some
explaination:
A disk generally consists of one or more platters, which are round
aluminum disks on which ferric oxide has been coated. Each platter is
served by (generally) two heads, one on the top and one on the bottom.
Each surface is divided into circular tracks, and each track is
divided into arc-shaped sectors which contain (generally) 512 bytes
each. The tracks have to be divided into sectors because the head
can't actually turn on and off instantly, and if you tried to change,
say, byte 2,345 on a track, you'd probably wipe out a few hundred
bytes on each side of the one you were trying to change. To
prevent this, the disk manufacturers make you read an entire
sector, make the change to the sector in memory, and the write the
entire sector back. Each sector is surrounded by an "inter-record
gap" which is a safe place to turn on and off the current to the write
head. The space taken up by these gaps is not inconsequential; in
fact, it may consume ten to fifteen percent of the disk.
Consequently, it's good to make the sectors as large as possible (that
way, less good disk surface is taken up by the inter-record gaps).
The problem is that the sector becomes the smallest unit of storage
that you can address! A typical disk has 512 bytes per sector, and
this means that if you have a one-byte file, it is stored on a 512
byte sector, with the other 511 bytes unused! Worse, DOS usually
treats eight physical disk sectors as the smallest allocatable unit of
storage (called a cluster), which means that that one-byte file
actually wastes 4,095 bytes! And some disk compression programs
encourage even larger clusters!!
Well, that second number tells you how much DOS has allocated for your
files. The difference between that number and the first one tells you
how much disk space the file system is "wasting" because of the
granularity of the file system itself. Unfortunately, there's not
much you can do about this...it's a problem built into the file
system. But if you want to see the problem in all its glory, look at
a directory full of Windows icons...each 766 byte icon gets allocated
4,096 bytes!
The third line tells you the space used in the first subdirectory of
C:\TEMP; that is, the OVERVIEW directory (C:\TEMP\OVERVIEW) in the
same format used in the previous line. The fourth line tells you that
the first subdirectory of OVERVIEW (C:\TEMP\OVERVIEW\EMPTY) has no
files (and so is appropriately named). The fifth line gives the space
used by the second subdirectory under OVERVIEW
(C:\TEMP\OVERVIEW\NONEMPTY).
Now, the sixth line is the interesting one. It gives the space used
by the OVERVIEW subdirectory AND ALL DIRECTORIES BENEATH IT. Add it
up yourself, and see.
The next subdirectory of C:\TEMP is named EMPTY, but it really isn't:
It contains the directory named NOTRLY. NOTRLY has no files or
subdirectories, so the third line indicates that there are no bytes in
files in the directory.
Well, the program lies slightly here. Each subdirectory is really a
file, and subject to the same constraints as a regular file.
Specifically, every subdirectory uses at least one cluster of storage
that isn't accounted for by this program.
The last line summarizes the storage used by the directory C:\TEMP and
ALL off its subdirectories. The same technique is used to scan any
directory on your disk. For instance, to see how much storage Windows
is using, you'd type SM "C:\WINDOWS".
USING THE SWITCHES: Other than the switches used to obtain help (/H
and /?) Space Map has three operational switches. Using any switches
other than those supported won't hurt anything, but they won't help,
either.
/F - This flag causes the program to print the name and space used
by EVERY file as it is encountered. For example, using the /F
flag on the directory shown above might give the following
display:
╔═══════════════════════════════════════════════════════════════════╗
║ Space map of C:\TEMP ║
║ ├─T.BAK..................25,566 bytes........28,672 allocated. ║
║ ├─T.ASM..................25,937 bytes........28,672 allocated. ║
║ ├─T.LST..................47,400 bytes........49,152 allocated. ║
║ ├─T.OBJ...................3,195 bytes.........4,096 allocated. ║
║ ├─T.COM...................3,310 bytes.........4,096 allocated. ║
║ ├─CURRENT.STS...............292 bytes.........4,096 allocated. ║
║ ├─LOOK.ASC..................734 bytes.........4,096 allocated. ║
║ ├─THEDRAW.PCK...............650 bytes.........4,096 allocated. ║
║ ├─TCTSR.ASM..............26,803 bytes........28,672 allocated. ║
║ ├─SM.DOC.................12,880 bytes........16,384 allocated. ║
║ ├─T.INC.....................504 bytes.........4,096 allocated. ║
║ ├─T.HLP.....................319 bytes.........4,096 allocated. ║
║ ├─Files total:..........147,590 bytes.......180,224 allocated. ║
║ ├─OVERVIEW: ║
║ │ ├─BUZZ.TXT..................248 bytes.........4,096 allocated. ║
║ │ ├─WHISPER.EXE............63,275 bytes........65,536 allocated. ║
║ │ ├─AGANZLK.TXT...........703,648 bytes.......704,512 allocated. ║
║ │ ├─Files total:..........767,171 bytes.......774,144 allocated. ║
║ │ ├─EMPTY: ║
║ │ ├─NONEMPTY: ║
║ │ │ ├─WHISPER.EXE............63,275 bytes........65,536 allocated.║
║ │ │ ├─Files total:...........63,275 bytes........65,536 allocated.║
║ ├─OVERVIEW..............830,446 bytes.......839,680 allocated. ║
║ ├─EMPTY: ║
║ │ ├─NOTRLY: ║
║ ├─EMPTY......................no files. ║
║ Directory total:......978,036 bytes.....1,019,904 allocated. ║
╚═══════════════════════════════════════════════════════════════════╝
(Before someone writes and tells me the file totals are different
here than in the previous example, don't bother. This is my
actual working directory! From the time one display was captured
to the time another was captured, some files grew and others were
added.)
/T - This flag causes the program to display the time and date
instead of the allocated space for both files and directories.
Allocated space will still be shown for the main directory and its
summary line. It may be combined with the /F flag. The result of
applying the /T flag to the above sample directory is shown below:
╔══════════════════════════════════════════════════════════════════╗
║ Space map of C:\TEMP ║
║ This directory:.......152,460 bytes.......184,320 allocated. ║
║ ├─OVERVIEW:.............767,171 bytes........91/12/18 13:58:42 ║
║ │ ├─EMPTY:.....................no files........91/12/18 17:43:50 ║
║ │ ├─NONEMPTY:..............63,275 bytes........91/12/19 13:10:00 ║
║ ├─OVERVIEW..............830,446 bytes........91/12/18 13:58:42 ║
║ ├─EMPTY:.....................no files........91/12/18 17:43:28 ║
║ │ ├─NOTRLY:....................no files........91/12/19 15:45:52 ║
║ ├─EMPTY......................no files........91/12/18 17:43:28 ║
║ Directory total:......982,906 bytes.....1,024,000 allocated. ║
╚══════════════════════════════════════════════════════════════════╝
/Dnn - The /D flag causes the program to stop displaying
directories after the nnth level. Using /D0 will cause the
program to just print the intro line and a summary line for the
entire directory structure. Here is what our sample directory
would look like with a /D1 option:
╔════════════════════════════════════════════════════════════════╗
║ Space map of C:\TEMP ║
║ This directory:.......136,577 bytes.......159,744 allocated. ║
║ ├─OVERVIEW:.............830,446 bytes.......839,680 allocated. ║
║ ├─EMPTY:.....................no files. ║
║ Directory total:......967,023 bytes.......999,424 allocated. ║
╚════════════════════════════════════════════════════════════════╝
Use the /Dnn option to limit the amount of information given in
the output. You can see much of a disk in just a few lines by
providing the appropriate /D switch. It may be combined with the
files (/F) switch and the time/date (/T) switch.
REDIRECTION: This program uses only DOS calls to send information to
the screen. Consequently, the output of the program can be redirected
to any DOS device, including a file, a printer, or a serial device.
In fact, sending the information to a printer is a good way to keep
permanent record of what's on your disk. To direct the output of this
program to a printer, just type:
SM >prn
PERFORMANCE: The program traverses the entire 80MB disk on an 286/8
in about fifteen seconds. It scans a 200MB drive on a 386/33 in about
twelve seconds.
NETWORK USE: Space Map works very nicely on a network, although it
may behave in a way you don't expect. First, if you're using a Novell
network and have drives MAP ROOTed to a server subdirectory, Space Map
will see through that. For example, if you have a file server named
SERVER1, a volume mounted on that server named SYS, and a subdirectory
on SYS named \USER\BOB mapped to drive G:, and you ask Space Map to
display drive G's contents, the top line will report that you are
viewing "\\SERVER1\SYS\USER\BOB". This is because Space Map uses
DOS's True Name function, and this is the true name to DOS of the
network drive. Space Map has been tested extensively only on Novell
networks, but should work on any network supported by DOS.
OTHER INFORMATION: If you need to communicate with the author, he is:
Ben Smith
110 S. Gardenia
Celeste, TX 75423
My CompuServe ID is 70143,2023, but I only check mail about twice a
week.
DEVELOPMENT INFORMATION: The program was developed using Microsoft's
Macro Assembler version 6.0 over a couple of days in December, 1991.
It is coded in 100% assembly language. The program was tested
extensively on two different computers: A Northgate 386/33 with a
200MB hard drive connected to a Novell NetWare 2.15C server via SMC
10baseT media; and an AMT-286 8MHz AT clone. Both machines run MS-DOS
version 5.
The program uses only standard DOS calls, with the exception of
Interrupt 21 function 60, Expand Path Name String. This function
works in all versions of DOS since version 3, and is reported to work
in the OS/2 1.x compatibility box. I would appreciate any reports of
incompatibility.
ENHANCEMENTS: I've thought of several things I could do to this
program to improve it, but none that could be done quickly or easily.
If you think of something I've left out of a program of this scope,
drop me a line. I can't promise I'll implement any suggestion (the
program IS free, after all) but I'll consider it and respond.
SOURCE CODE AVAILABILITY: Source code can be made available on a paid
license basis. Contact me by mail or CompuServe for other details.
The price of a source code license would depend greatly on the use to
which the code is to be put, but I'm very reasonable!