home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 9
/
FreshFishVol9-CD2.bin
/
bbs
/
util
/
usage-1.06.lha
/
Usage
/
Usage.doc
< prev
next >
Wrap
Text File
|
1994-03-21
|
9KB
|
254 lines
-----------------------------------------------------------------------------
Usage 1.06 User Manual 21th of March, 1994
Copyright © 1994 Janne Kiiskilä
Janne Kiiskilä
Kalervontie 1 C 4
FIN-90570 OULU
FINLAND
-----------------------------------------------------------------------------
1. INTRODUCTION
What exactly is Usage? Usage is basicly the du (disk usage) command
from UNIX. The only difference is, that this program has more
options, mainly the availability to make comparisons and return WARN
if the given amount is exceeded. And, of course wildcards, too. Now
you can check out for example the amount of .info's on your precious
hard disk (I've got over 600 KBs on my boot partition only)...
This program was coded because we will need a command like this
in the future when we install MuFS to the Amiga 4000 at the Oulu
University. Each user will have a home-directory of their own,
and we need to limit that size and warn the user if the preferred
disk usage is exceeded.
Also, the previous DU command that I had wasn't hit-free, it
produced some Enforcer hits when executed. I don't like Enforcer
hits, so that gave me some more motivation to do this program.
-----------------------------------------------------------------------------
2. COPYRIGHT & DISCLAIMER
This program is copyrighted, but FREELY DISTRIBUTABLE. If you use
it and like it, a donation or gift would be nice; a postcard,
intros, demos, public domain software, money etc. I'm a student,
and money simply doesn't want to live with me... ;(
Selling this program for more than reasonable media cost is strictly
forbidden. A special permit is given to Fred Fish so that he can
include this program to his CD-ROMs. Also, this program may be
copied to the AmiNet CD-ROM. Others may require this permit from
me, contact address is in the CONTACT THE AUTHOR part of this
document.
Add all standard disclaimers here, I'm in no way responsible
of what this program might cause to you; may it be data corruption,
number of aliens visiting your house, mental or physical health
problems. This program has been thoroughly tested and it should
not cause any problems, but who am I to promise anything? Big
companies can't keep their promises either - Microsoft 100%
guarantee of bugged & bloated software.
-----------------------------------------------------------------------------
3. INSTALLACTION & USAGE
Quite simple, just copy the program USAGE to the directory
you wish it should be in, just make sure your PATH points to
that directory. Please refer to the manuals of your computer
on the COPY and PATH-command.
Usage [OPTIONS] [PATH] [OPTIONS]
Path is the path/volume of which you want to know the disk usage.
Only one parameters has to be given, it may be the path or any
of the options. If a path is not given, the current directory
will be scanned.
ALL - recursive, calculate the size of all sub-directories too
QUIET - no output at all, expect errors
SHORT - print only the first level of directories
VERBOSE - print the directories and their sizes
LEVEL - print only the given amount of directory levels
COMPARE - compare the disk usage to a given amount, which MUST
follow immediately after the COMPARE keyword.
NOADD - as of version 1.04 the default output form has been
been changed, use this option for the previous output.
By default the size of a parent directory is calculated
not only from the files within that directory but it's
subdirectories, too (just like the du in UNIX).
FILELIST - create a filelist of files used for disk usage calculation.
The option LEVEL does not affect the file creation.
Options may be given in upper or lower case, the checking is not
case sensitive. And, they may be given in any order as well.
Some examples might clear things out;
USAGE
- no parameters, short instructions displayed
USAGE RAM:
- calculate the disk usage of RAM:
USAGE ALL
USAGE -A
- calculate the disk usage of the current directory and all of its
subdirectories, too.
USAGE RAM: ALL
USAGE RAM: -A
- calculate the TOTAL disk usage of RAM:
USAGE RAM:*.info ALL
- calculate the TOTAL amount of .info-files on RAM:
USAGE RAM: ALL QUIET
- calculate the TOTAL disk usage on RAM: do not produce any output
(except possible memory allocation errors etc!)
USAGE RAM: ALL SHORT
USAGE RAM: ALL LEVEL 1
USAGE RAM: -A -L 1
- calculate the TOTAL disk usage on RAM: and display the amount of
disk space used in the first directory levels.
USAGE RAM: ALL VERBOSE
USAGE RAM: -A -V
- calculate the TOTAL disk usage on RAM: and display the amounts as
the program preceeds in the directory tree. Like the DU command in
UNIX.
USAGE RAM: ALL VERBOSE FILELIST TEMP:files
USAGE -A -V -F TEMP:files RAM:
- calculate the TOTAL disk usage of RAM: and display the amounts
as the program preceeds in the directory tree. Saves the filenames
used for disk usage calculation to TEMP:files.
USAGE RAM: ALL COMPARE 100
USAGE RAM: ALL COMP 100
USAGE RAM: -A -C 100
- calculate the TOTAL disk usage on RAM: and compare the amount to
100 KILOBYTES and return WARN if the amount is exceeded.
USAGE RAM: ALL COMP 100 VERBOSE
USAGE RAM: -A -C 100 -V
- same as above, but also displays the size of each directory as
the program works its way through the directory tree.
And all of the other variations you can imagine. You can't use
the keywords QUIET, VERBOSE and SHORT on the same command line!
If you want to have that traditional DU-command familiar from
UNIX (and Amiga-ports) define an alias like this in your S:SHELL-STARTUP
ALIAS DU USAGE ALL VERBOSE
or, any other way you prefer it.
See the file HomeFull.script in this archive for an example of
how to use the COMPARE-option in a script.
-----------------------------------------------------------------------------
4. BUGS
There aren't any bugs I know of at this point. But, there are
a few things you should remember. This program is recursive,
the sub-directory scanning is done with recursion. Recursion
uses the stack. Each recursion level uses stack about 100 bytes.
The program currently allocates a stack of 10240 bytes IF you
use a smaller stack. That amount is enough for about 80 directory
levels, but if you have VERY complex directory structures please
use the STACK command to increase the stack size before running
this program with the ALL-switch.
Please do notice, that using CTRL-C to abort the program while
it is scanning a directory will cause memory loss. The program
is recursive, and the temporary path names allocated by each
recursion level are lost.
But, if you do happend to find a bug or two, please inform me
immediately and I will try to fix them. Or, if you have any
nice improvement ideas. My address is in the CONTACT THE AUTHOR-
part of this documentation.
-----------------------------------------------------------------------------
5. NOTES
This program was compiled using the SAS/C Development System
version 6.51 and tested with Enforcer and Mungwall; hit free
program.
This program needs at least dos.library version 37, ie.
KICKSTART 2.0 is required! Go and get an upgrade if you're
still using 1.2 or 1.3. Or even better, go get yourself
an Amiga 1200 or 4000...
-----------------------------------------------------------------------------
6. CONTACT THE AUTHOR
The quickest way to reach me is email, but I read my snail
mail too.
Janne Kiiskilä
Kalervontie 1 C 4
FIN-90570 OULU
FINLAND
email:janne.kiiskila@oulu.fi,
jannek@stekt.oulu.fi,
jannek@paju.oulu.fi,
jannek@phoenix.oulu.fi
-----------------------------------------------------------------------------
7. HISTORY
VERSION 1.06 (21.3.1994)
- new option, FILELIST. Creates a list of all the files used for
the disk usage.
- added a new option, LEVEL. It defines the number of directory
levels to be printer when scanning the directory tree. It does
NOT define the level of directories to scan through!
- cleaned up the sour