File DISK-ORG.ZIP from The Programmer’s Corner in
Category Databases and related files
Excellent disk organization system.
File Name File Size Zip Size Zip Type
DEFAULT.DOG 264 194 deflated
DOG.DOC 26755 7026 deflated
DOG.EXE 36576 17527 deflated
DOGMAKE.COM 4760 3032 deflated
ERRATA.DOC 1013 570 deflated
INSTALL.DOC 605 335 deflated
ORDER.DOG 1414 514 deflated

## Contents of the DOG.DOC file

Disk OrGanizer - Version 1.01a
June 1, 1986
Soft GAMs Software

Soft GAMs Software
G. Allen Morris III
1411 10th Avenue
Oakland, CA 94606

INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . 1

COPY PROTECTION . . . . . . . . . . . . . . . . . . . . . . 1

BACKGROUND PROGRAMS . . . . . . . . . . . . . . . . . . . . 1

LIMITS . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

ORGANIZING YOUR DISK . . . . . . . . . . . . . . . . . . . . 3

RUNNING Disk OrGanizer THE FIRST TIME . . . . . . . . . . . 4

ADVANCED FEATURES . . . . . . . . . . . . . . . . . . . . . 5

COMMANDS . . . . . . . . . . . . . . . . . . . . . . . . . . 8

SHAREWARE

This is a shareware program. Programs that do a similar function

You may copy and distribute this program freely, provided that:
1) No fee is charged for such copying and distribution, and
2) It is distributed ONLY in its original, unmodified state.

This program is not free, if you use it you must pay what ever you
think it is worth to you.

You may not use this product in a commercial environment or a
governmental organization without paying a license fee of
available.

Address all correspondence to : G. Allen Morris III
1411-10th Avenue
Oakland, CA 94606

If you fail to abide by the terms of this license your karma will
never be the same.

INTRODUCTION

This program was written to help people speed up their disk
access, it will be of most help to people that are using large
data files or programs that use overlays.

What the program does is allow you to de-fragment and order the
files and sub-directories on a disk. The program also compresses
the directories which will speed up finding files in directories.
It can also free some disk space by truncating Sub-directories.

Disk OrGanizer will make UN-deleting files easier in any case.

COPY PROTECTION

Because of the nature of Copy Protection I would advise you to
un-install any copy protected software before you run Disk
OrGanizer. Disk OrGanizer may work with some copy protection
schemes. The best way to decide if you can use Disk OrGanizer with
your copy protected software is if it says that it is ok to copy
it from one directory to another then you will probably be able to
run Disk OrGanizer with it installed. Disk OrGanizer does not
move Hidden files or hidden sub-directories.

Some copy protection schemes use an odd code to mark a cluster as
bad and store some weird data in that location. At the present
time Disk OrGanizer will not run with any odd looking FAT

locations. If you get illegal cluster errors you probably have
some copy protected software installed that you forgot about.

The best thing is just not to buy copy protected software or run
it from floppy disks. If no one bought copy protected software
there wouldn't be any.

BACKGROUND PROGRAMS

You can not have BACKGROUND programs that read or write the disk
that you are organizing. The reason for this is that Disk OrGanizer
writes directly to the disk and does not use DOS calls, so DOS
will not know were to read or write data to or from. Which will
cause them to read garbage and to write to Clusters that are used
by other files or sub-directories. If writes occur large amounts
of data can be lost as the sub-directories can be over written.

DATA LOSS

In normal operation there should be no data loss, with the exception
of write errors that are not detected by DOS. Disk OrGanizer
sets the DOS VERIFY switch ON this is the same verification that
DOS uses to verify data that is Copied. (Look in the DOS reference
guide for more on VERIFY.) Disk OrGanizer has as switch that will
allow it to run without verifying data and it will run faster if
it does not verify the data, but there is a greater chance of
data loss. I would suggest that you use the verify on floppy disks.
On hard disks it is up to you, I have not had a write error on my
hard disk after running it for over a year.

POWER FAILURE

In a power failure some problems can occur, but they can all be
fixed buy running CHKDSK and Disk OrGanizer.

If a file is being moved there is only a problem if the power
failure occurs between the time that the directory is written and
the FAT is written, CHKDSK can recover all of the data as it will
be in two places on the disk. To recover from this run 'CHKDSK /F'
you will see the following:

1 lost cluster found in 1 chains.
Convert lost chains to files (Y/N)? (Answer No)
nnnn bytes disk space freed.

You will then get the rest of the information from CHKDSK.

If Disk OrGanizer was moving a sub-directory then you may also see
the message:
d:\subdir\sibling
Invalid sub-directory entry.

This message is generated if the power failure occurred between
writing the sub-directory and it's sibling. You may get messages
stating that there are more than one invalid sub-directory entries.
This is normal as long as they all are sibling of the same parent.

If Disk OrGanizer was writing the file allocation table (FAT)
when the power failure occurred CHKDSK may display:

It will then use the second FAT to repair the first FAT.

If Disk OrGanizer was writing the second FAT you may get an error
from Disk OrGanizer saying:

Would you like to continue?

Answer yes to this if you ran CHKDSK before running Disk OrGanizer.

NOTE:
It is always important to run CHKDSK after a power failure to
correct any problems that may have occurred whether you were running
Disk OrGanizer or not.

LIMITS

Because the FAT and directories are read into memory there are
some limits to their sizes.

There must be less than 32000 clusters on the disk. If you have
on the bulletin board listed below and we can talk about getting
you a special version of Disk OrGanizer.

There also cannot be more than 2000 files any one directory. Again
if you have this problem I can probably modify the program to run

The only other limit is how much memory your computer has limits
the total number of files that can be on the entire disk. Each
directory entry takes about 34 bytes so if you have 300k of free
memory you will be limited to about 8000 total files before you
run out of memory.

It is hard to say what is the best way to organize a disk as it
will be different for each application. But I will try to describe
some of the main considerations here.

First we need a slight understanding of how MSDOS handles the
files on a disk.

Opening a file: When a file is opened DOS creates a FILE handle
for the file. The number of file handles that can be opened is
controlled by the FILES= command in your CONFIG.SYS file. In the
FILE handle DOS saves information about were the data is stored
on the disk. This involves reading the directory or directories
if the file is not in the current directory and reading the FAT.

Reading from a file: When data is read from a file DOS looks at
the FILE handle to find the data and then reads the data into one
of the buffers that were defined in the BUFFERS= command in the
CONFIG.SYS file. If this data is read again it will be read out
of this buffer and not off the disk.

Writing to a file: When data is written to a file DOS looks to
see if the data from the location that it is going to write to is
in a buffer, if it is DOS over writes the buffer and then writes
the data to the disk. If the data was not already in a buffer
DOS will put the data into a buffer and then write it to the disk
if this data is then read DOS will get the data from this buffer
rather than the disk.

Closing a file: Closing a file that was only read from requires
no reads from or writes to the disk. If the file has been altered
then DOS uses the data in the FILE handle which was updated during
each write to update the directory entry for the file and update
the FAT.

We can see from this that the FAT and directory is only used when
a file is opened or closed. Because of this it is not terribly
important to keep the files on the outer tracks (close to the
FAT) unless the file is opened and closed often.

So what files are opened and closed a lot? Well Batch files are
opened and closed between each operation. EXE and COM files that
are simple utilities such as ASK.COM are also opened and closed
often. Overlay files are also opened and closed often, QMODEM
would run faster if it's overlay files were on the outer tracks.
Larger EXE and COM files should come after these as they are not
opened and closed as often.

All of these files almost never change in size and therefore will
not become fragmented this also makes them good candidates for
being put on the outer tracks of the disk.

Many data files are opened once read many times and then closed.
Most of the time on these files is spend reading the data and if
there are not enough BUFFERS to hold the entire file the disk
will have to be read repeatedly. So the location of these files
is not very important but it is important that the data in the
file is close together. Also if the file is used by a database
manager and is indexed by another file we would want both of these

files to be close together. In some applications there may be
many files that are open at the same time and we would want all
of them to be close together.

The last type of file I can think of is a data file that is written
to often. These files change size and become fragmented. Yet
many of these files have the same needs as the previous type. If
these files are placed last Disk OrGanizer will be able to de-
fragment them faster and therefore they should be placed last on
the disk.

RUNNING Disk OrGanizer THE FIRST TIME

Disk OrGanizer has been tested with MSDOS 2.10 and MSDOS 3.00. It
has also been used on disks as large as 30 Megabytes. There is
extensive testing done to make sure that the disk can be read and
written and that the FAT and the directories are in good repair.
It is very unlikely that Disk OrGanizer will hurt the data on
your disk, but it is always a good idea to have the data on a
hard disk on BACKUP disks or tape and to have a copy of data on
floppy disks.

DOG requires that an input file be somewhere.

There are three ways to do this:
1) Create ORDER.DOG in the root directory of the disk you are
Organizing.
2) use SET DOG=d:\path\filename.ext to a .DOG file.
3) run DOG [d:] d:\path\filename.ext.

The .DOG file can be empty or you can use the \DEV\NUL device.

If you want to Disk OrGanize a floppy disk you can use the following
command:

DOG A: NUL

Disk OrGanizer will then give you a report about the fragmentation
of the disk and give you four choices on how you can order the
disk. The Fragmented order is probably the best for floppies.
You could have told it before hand to use fragmented ordering by
giving the command:

DOG A: NUL /FR

There are several ways that Disk OrGanizer can Optimize the data
on your disk. They are as follows:

Fast Order.

This forces all un-fragmented files to stay were they are
and then attempts to put fragmented files into free areas
that are left. If a fragmented file will not fit into any
of the free areas it is then stored in two or more of the
free areas.

Directory order.
This puts the files onto the disk in the order that they are
in the directories. You can use the TREE command to get a
rough idea of what this looks like.

Packed order.
This leaves the files in the same order as it finds them on
the disk. It will leave only one area of free disk space at
the outer tracks of the disk.

Fragmented order.
This will put all of the files that are not fragmented on
the disk first and will then put the fragmented files on the
disk. Using this function will slowly put all of the files
that change size on the inner tracks of the disk.

Ok so you want you files to be just so. In order to do this you
will need to make a file that lists the files in the order that
you want them on the disk. Files need to have there full path
names included. Sub-directories are treated as files and not as a
wild card pointing to all of the files in the sub-directory.
There is also a switch that can be included to tell Disk OrGanizer
where to leave free space.

The utility DOGMAKE is included to help you make this file. You
may also need a text editor that has a non-document mode to sort,
delete or add to this file.

The default name for this file is "ORDER.DOG" and it should be in
the ROOT directory of the disk being worked on, or you can also
give Disk OrGanizer the name and path of the file you wish to use.

Below is a sample of what this file should look like.

[noverify]
[fast] ;This tells Disk OrGanizer how to handle
;any unnamed files or sub-directories.
[TRUNcate]
\SUBDIR_A
\SUBDIR_B
[ENDTruncate]
[FORCe]
\COMMAND.COM ;This fill force COMMAND.COM to remain
\COPYPRO.COM ;were it is. This command should come
;before any other files are named. This
;command will not be of much use to most
;users.
[ENDForce] ;This tell Disk OrGanizer that the fol-
;lowing file should be placed in order.
\AUTOEXEC.BAT
\PROG1.OVL
\SUBDIR_A\PROG1.OVL ;This is different than \PROG1.OVL
\SUBDIR_A ;These are the sub-directories them selves.
\SUBDIR_B
[HIGH] ;This tell Disk OrGanizer that the rest
;of the files should be placed on the
;inner tracks.
\CONFIG.SYS ;This will be the last file on the disk
;and its last cluster will occupy the
;last cluster on the disk.
\ORDER.DOG ;You can include this file.

As you can see it will take some work to make this file. The DOGMAKE
utility can help you make this file. Basically DOGMAKE is a WHEREIS
program. The difference is that it outputs the full path name
along with the file or sub-directory name. it output goes to the
standard output device.
So you can either run DOGMAKE *.* and then use your text editor to
sort the data or you can run DOGMAKE something like this:

DOGMAKE command.com > \order.dog
DOGMAKE autoexec.bat >> \order.dog
DOGMAKE *.ovl >> \order.dog
DOGMAKE SUBDIR* >> \order.dog
DOGMAKE CONFIG.SYS >> \order.dog
DOGMAKE ORDER.DOG >> \order.dog

This would give you a file resembling the ORDER.DOG sample above.

After you have gotten ORDER.DOG made you can run Disk OrGanizer.

Use the following command:

DOG

If you want to use a different filename than "\ORDER.DOG" you can
use:

DOG path\filename.ext

COMMANDS

DOG [d:] [path\filename.ext] [/FA|/FR|/PA|/DI] [/NV] [/BATCH]

[FAST] /FA This forces all un-fragmented files to stay
were they are and then attempts to put frag-
mented files into free areas that are left.
If a fragmented file will not fit into any of
the free areas it is then stored in two or
more of the free areas.

[FRAGMENTED] /FR This will put all of the files that are not
fragmented on the disk first and will then
put the fragmented files on the disk. Using
this function will slowly put all of the files
that change size on the outer tracks of the
disk. You can use this function to get a similar
effect to the special order function but it
will take several passes over several days.

[PACKED] /PA This leaves the files in the same order as it
finds them on the disk. It will leave only
one area of free disk space at the outer tracks
of the disk.

[DIRECTORY] /DI This puts the files onto the disk in the order
that they are in the directories. You can use
the TREE command to get a ruff idea of what
this looks like.

[NOVERIFY] /NV This tells Disk OrGanizer to turn off the MSDOS
verify switch. Disk OrGanizer turns on the
verify switch unless told not too.

[NOCOPYPRO] /NC This keeps Disk OrGanizer from asking you if
you have removed all of the Copy Protected
software from the disk.

[NOBACKGROUND] /NB This keeps Disk OrGanizer from asking you if
you have inhibited Background and Multi-Tasking
software.

[BATCH] /BATCH This will inhibit all queries of the operator.
If an error occurs Disk OrGanizer will termin-
ate processing and return with an error code.
This should only be used after you have run
Disk Organizer several times and only if you
have no Copy Protected software and no Multi-

tasking software. All errors a fatal when
Disk Organizer is in BATCH mode. This will
keep Disk Organizer from holding up the batch
process. If no order is specified, Fragmented
order will be used.

[HIGH] This tells Disk Organizer to put the rest of
the files in ORDER.DOG on the inner tracks of
the disk.

[FREE nn] This tells Disk Organizer to leave nn clusters
of free space. There must be enough free
area on the disk or the command will be ignored.

[FREE *] This tells Disk Organizer to leave all of the
free space available at this location.

[FORCE] FORCE allows you to keep Disk OrGanizer from
doing any work on a particular file or group
of files. It must be followed by an ENDFORCE.

[ENDFORCE] This tells Disk OrGanizer to stop FORCEing

files.

[TRUNCATE] TRUNCATE tells Disk OrGanizer to remove extra
clusters from Sub-Directories. DOS will expand
Sub-directories as needed but it does not
shrink them when you delete files. You must
specify all of the Sub-directories that you
wish Disk OrGanizer to try to make smaller.

[ENDTRUNCATE] This tells Disk OrGanizer that there are no
more sub-directories listed for truncation.

INDEX

[BATCH] . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
[DIRECTORY] . . . . . . . . . . . . . . . . . . . . . . . . . 8
[ENDFORCE] . . . . . . . . . . . . . . . . . . . . . . . . . . 9
[ENDTRUNCATE] . . . . . . . . . . . . . . . . . . . . . . . . 9

[FAST] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
[FORCE] . . . . . . . . . . . . . . . . . . . . . . . . . . 7, 9
[FRAGMENTED] . . . . . . . . . . . . . . . . . . . . . . . . . 8
[FREE *] . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
[FREE nn] . . . . . . . . . . . . . . . . . . . . . . . . . . 9
[HIGH] . . . . . . . . . . . . . . . . . . . . . . . . . . . 7, 8
[NOVERIFY] . . . . . . . . . . . . . . . . . . . . . . . . . . 8
[PACKED] . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
[TRUNCATE] . . . . . . . . . . . . . . . . . . . . . . . . . . 9
/BATCH . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
/DI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
/FA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
/FR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
/NV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
/PA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
BACKGROUND PROGRAMS . . . . . . . . . . . . . . . . . . . . . 1
DATA LOSS . . . . . . . . . . . . . . . . . . . . . . . . . . 1
DOGMAKE . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
DOS I/O
Closing a file . . . . . . . . . . . . . . . . . . . . . 4
Opening a file . . . . . . . . . . . . . . . . . . . . . 3
Reading from a file . . . . . . . . . . . . . . . . . . . 3
Writing to a file . . . . . . . . . . . . . . . . . . . . 3
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . 1
LIMITS . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
ORDER.DOG . . . . . . . . . . . . . . . . . . . . . . . . . . 6
ORGANIZING YOUR DISK . . . . . . . . . . . . . . . . . . . . . 3
POWER FAILURE . . . . . . . . . . . . . . . . . . . . . . . . 2
RUNNING Disk OrGanizer THE FIRST TIME . . . . . . . . . . . 4

December 11, 2017