home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 2
/
ctrom_ii_b.zip
/
ctrom_ii_b
/
PROGRAM
/
PASCAL
/
DU111
/
DU.TXT
< prev
Wrap
Text File
|
1991-10-29
|
5KB
|
126 lines
1. Overview.
DU is a small UNIX-like utility to show how much space is occupied by a
directory tree.
It can show how much space is occupied by the entire directory tree or by
any number of filespecs, optionally excluding any number of filespecs, it
can show the size of every file, just the directory totals, or just the
grand total.
Starting with v1.09 DU is supposed to accept the (all too few) Unix-du-
options.
2. Basic syntax.
Arguments may be options, filespecs or directory names. The directory
names separate the other arguments into global and local arguments:
du {global arguments} {base directory {local arguments} }
DU searches through each directory for the files specified before the
first directory name (global arguments) and those between this and the next
directory name (local). If no directory name is specified, . (the current
directory) is used.
Later options override earlier, eg. a local /0 overrides a global /1.
If any include filespecs are specified, the directory table will not be
counted in the directory size. Exclude filespecs don't matter.
Both / and \ may be used in paths, and both / and - as switch character.
DU will generally figure out what you mean. If it doesn't you'll get an
error message.
3. Command line options.
Option a (du /a or du -a) will list the file sizes as well as the
directory totals.
Option d will show DU's interpretation of the arguments.
Option h (or ?) will display a short help screen.
Option i will include the following filespecs; refer to part 4.
Option n will not include subirectories in the directory size.
Option s will skip the directory totals and display only the sum. This
is exactly the same as -0.
Option w will show the percentage of space wasted due to too-large
clusters.
Option z will suppress 0k files and directories.
Option 0..65535 shows directories down to the specified level.
Directories deeper are counted but not listed.
Option x will exclude the following filespecs, refer to part 4.
4. Filespecs.
Standard Unix DU always counts all the files. This version, however,
allows you to count only some files or all except some files.
If you don't specify an include filespec, * (which matches everything)
will be used.
If you do specify one or more filespecs, only files matching one (or
more) of the specs are counted.
You can exclude files as well, and include files again.
The filespecs aren't limited by the normal brainless DOS rules. * and ?
work, but match . as well as normal chars. You can also match a list, like
[a-cx], which matches a, b, c and x. Note that it isn't completely Unix-
ish either.
4. Examples.
These are examples of the options I use. Sorry, you won't find examples
of every last option here. As you can see, I use both / and - as switch
characters.
du -1 / shows how much each directory subtree takes, counting all the
directories but showing only those directly below the root.
du -az *asm* -x ?asm.*
displays the size and path of every file whose name contains ASM anywhere
except in the 2..4 position, and how much space these files occupy in each
directory. Empty directories are not shown. RM.ASM and OBJ2ASM.COM is
listed, TASM.EXE isn't.
du -zn *.obj
shows how much space is occupied by .obj files in each directory that
contains at least one (0k directories aren't shown). .obj files in
subdirectories aren't counted in the directory size.
du -as *.bak *.bk[!1-9] *.old
shows all the backup files in the directory tree, ie. files with a file
type of BAK, BK!, BK1, BK2, BK3, BK4, BK5, BK6, BK7, BK8, BK9 or OLD.
du /x *.bak *.bk[!1-9]
shows the directory totals excluding any backup files.
du *gif* -x *gif*.exe /i vgif*
searches for files containing 'gif' anywhere in the name or extension,
except files containing 'gif' in the name and with an extension of 'exe',
but including files whose name starts with 'vgif'. Pretty far-fetched.
du /s *.zip *.arc *.arj *.lzh *.gif *.jpg *.pcx *.bmp
finds out how much of your precious hard disk is wasted on archives or
pretty pictures.
6. Bugs
The root directory doesn't exist, according do Mess-DOS' own FindFirst
function. My workaround is to search for a directory called 'dirname'
first, and if that doesn't work to search for anything called
'dirname\*.*'. This should work for everything except completely empty
drives.
The directory table size is only an estimate, and sometimes too low.
DU does some checking for cluster sizes, not much. JOIN, SUBST and many
networks will fool it; in those cases it assumes either 1k or the cluster
size of the default drive.
The 'wasted space' percentage is incorrect on Stacker volumes, as Stacker
will use the 'wasted' space for something.
DU often says that more space is wasted that Norton FS does. This is
because DU counts the directory table as well as the files.
You can't start filespecs with /, to avoid clashes with options.
7. Send me a card?
If you like or use DU or any of my other utilities, please send me a
postcard at the following address:
Arnt Gulbrandsen
Postboks 1036
N-7801 Namsos
Norway
If you have any questions / comments, send them to me at the above
address or by email to agulbra@siri.unit.no.