Dec 282017
 
Sort & Pack directories for DOS.
File SAP300.ZIP from The Programmer’s Corner in
Category File Managers
Sort & Pack directories for DOS.
File Name File Size Zip Size Zip Type
SAP300.ASM 69628 12996 deflated
SAP300.COM 2867 2032 deflated
SAP300.DOC 13133 4248 deflated

Download File SAP300.ZIP Here

Contents of the SAP300.DOC file


Sort and Pack Directory

SAP300.COM
Version: 3.00
Date: November 6, 1985
Author: Don A. Williams
3913 W. Solano Dr. N.
Phoenix, AZ 85019


********************* N O T I C E *********************
* Contrary to the current trend in MS-DOS software, *
* this program, for whatever it is worth, is NOT *
* copyrighted! The program, in whole or in part, *
* may be used freely in any fashion or environment *
* desired. If you find this program to be useful *
* to you, do NOT send any contribution to the *
* author; in the words of Rick Conn, 'Enjoy!' *
* However, if you make any improvements, I would *
* enjoy receiving a copy of the modified source. I *
* can be reached, usually within 24 hours, by *
* messages on any of the Phoenix FIDO systems, *
* particularly: *
* *
* FIDO 114/8 Bob's Answering Machine *
* (602) 242-3158 300/1200 bps *
* FIDO 114/1 Phoenix Node *
* (602) 242-5230 300/1200/2400 bps *
* FIDO 114/446 XTRA #1 *
* (602) 979-6352 300/1200/2400 bps *
* Technoids Anonymous [PCBOARD] *
* (602) 899-4876 300/1200/2400 bps *
* *
* *
* Every effort has been made to avoid error and *
* moderately extensive testing has been performed *
* on this program, however, the author does not *
* warrant it to be fit for any purpose or to be *
* free from error and disclaims any liability for *
* actual or any other damage arising from the use *
* of this program. *
*******************************************************


SAP is a small program that will read in an entire Directory or
Sub-Directory, sort it into alphabetic sequence on names,
optionally remove all entries for erased files, and write the
Directory or Sub-Directory back to disk. The purpose is to allow
the standard MS-DOS command, DIR, to show the names in an
intelligible form and to speed up MS-DOS directory processing by
eliminating the erased entries. SAP will also ensure that any
sub-directories in the directory being sorted sort first to help
speed up MS-DOS directory processing.

Changes between this documentation and prior versions will be
indicated by 'change bars', i.e. the character '|' in the right
margin.

There is a major exception to the sort. An MS-DOS system disk
contains two files that MUST be the FIRST two files in the root
directory. These files contain MSDOS itself and the BIOS for the
system. Unfortunately, there is no sure way to distinguish these
files from any other files although usually they have the System
and/or Hidden attributes and their Extension is 'SYS'. If either
of the first two files in the root directory have the System and
Hidden attributes or an Extension of 'SYS', SAP will assume that
the disk is a system disk and will exclude the first two files
from the sort.


USAGE:

The Command Line format for SAP is as follows: |


A>sap [path_name] [options] |

where path_name is a standard MS-DOS path name with optional disk |
specification (A:, B:, etc.). The path name must not contain any |
ambiguous elements (i.e. the path name must not contain any '*' |
or '?' characters) and the elements of the path name must be |
separated by either '\' or '/' characters. The use of the '/' as |
an element delimiter in path names is somewhat unusual, however, |
many components of MS-DOS (not all) will accept it and there are |
useful programs, such as the excellent editor, BRIEF, which use |
it. |

If no disk is specified in the path name, SAP will work on the |
'current' or 'default' disk, the disk shown in the MS-DOS prompt. |
If the first character of the path name, after the optional disk |
specification, is a '\' or '/', SAP will assume that the path |
starts at the root directory. If the path name does not begin |
with a '\' or '/', SAP will assume that the path starts at the |
'current' directory and will prefix the specified path name with |
that of the current directory before using it. |

The current version of SAP has four command line options; No |
Query, Detail Statistics, Sort Subdirectories, and Eliminate |
Erased Files. The options are preceded by the character '/' and |
have the following form: |

/n-No Query |
By default, SAP will display the full pathname of |
the directory to be sorted and request operator |
confirmation before proceeding. The No Query |
option will suppress the request for operator |
confirmation. |

/d-Detail Statistics |
The Detail Statistics option will cause SAP to |
display the counts of active entries and erased |
entries for each subdirectory sorted. |

/s-Sort Subdirectories |
By default, SAP sorts only the directory |
specified. If the Sort Subdirectories option is |
specified, SAP will sort the specified directory |
and all subdirectories below it |

/e-Eliminate Erased Files |
If the Eliminate Erased Files option is specified, |
SAP will remove the entries for all erased files |
from the subdirectories sorted and replace them |
with 'unused' entries. |

The options and the file specification may be entered in any |
order and in any case and the options may be entered individually |
or as a string. For example: |

C:>SAP DIR1 /E /S /N /D |

and |

C:>SAP /ensd dir1 |

will have the same effect. |


EXAMPLES:

Following are some simple examples of the usage of SAP:

1. A>sap

This form of the SAP command will sort the 'current'
directory of the 'current' or 'default' disk (the
disk shown in the MS-DOS prompt) disk A in this
example.

2. A>sap /n

This form of the SAP command has the same effect as
that in 1. except that SAP will not pause for
operator confirmation before sorting the directory.

3. A>sap \

This form of the SAP command will sort the Root
directory of the 'current' or 'default' disk (A in
this example) 'A:\'.

4. A>sap TEST/DIRE1

If the 'current' directory were '\JUNK', this form of
the SAP command would sort the directory,
'A:\JUNK\TEST\DIRE1'.

5. C>sap \ASM\SAP

This form of the SAP command would sort the
directory, 'C:\ASM\SAP'.

6. C>sap A:\ASM\SAP

This form of the SAP command would sort the directory
'A:\ASM\SAP' despite the fact that the 'current'
disk, as shown in the prompt, is C.

7. C>sap A:\ASM\SAP /d |
|
This form of the SAP command would have the same |
effect as that in 6. above except that, after it had |
sorted the directory, SAP would display the absolute |
sectors occupied by the directory, the number of |
active entries in the directory, and the number of |
erased entries removed. |

8.C>sap \ /ns

This form of the SAP command would sort all of the |
directories on drive C without pausing for operator |
confirmation. |


COMMENTS:

SAP does NOT rearrange the contents of the files on disk, it
works solely on the contents of the directories.

SAP2.01 is very much a 'hack' job. It was written as a vehicle
to gain experience with 8088/86 assembly language and was almost
'debugged' into existence. It has only moderate functional
modularity. Later versions, in a cleaner internal state, will be
issued, however, the current version functions correctly. The
reason for cleaning up the internal state will be to aid
maintenance and further extension. Also, some of the routines
used by SAP would have general application in other programs.

Version 2.01 of SAP contains a Shell-Metzner Sort algorithm
instead of the simple Bubble Sort used in Version 1.01. Unless
your directories are very large [in excess of 200 entries!] you
probably will not notice any difference in execution time.

Version 2.01 of SAP does not release any Allocation Units
(Clusters) of the directory that are no longer used after the
directory has been packed. A later version of SAP will provide
the function to reclaim unused disk space. It is not likely that
this function will be of any great benefit. The smallest
Allocation Unit used by MS-DOS, 1k bytes, is sufficient to hold
64 files and it is not likely that any sub-directory will hold
more than 64 files. On a 10meg hard disk with 4k byte ALUs, the
minimum ALU will hold 256 files.

Version 2.50 of SAP is a relatively extensive cleanup of the
source program in preparation for inserting a recursive ability
that will allow SAP to sort ALL of the directories on a disk with
a single evocation. Also, two switches have been added to allow
the operator to specify no confirmation before sorting and to
request display of the statistics; SAP 2.50 has been modified to
suppress these statistics by default.

Although SAP is not currently recursive, SAP 2.50 can be used
with WalkTree by the same author to sort the directories of an
entire disk with a single command. The command to accomplish
this would be:

C:>WT SAP /N

The most recent version of WalkTree at the time of release of SAP
2.50 is WT100, the first release of WalkTree.

Version 3.00 of SAP adds the recursive ability to sort a |
directory and all subdirectories below it in the hierarchy. |
Further cleanup of the internal program structure also |
necessarily occurred. Switches were added to active the |
recursion and to cause SAP to replace entries for erased files |
with 'unused' entries. |

Only one further major release of SAP is anticipated, SAP 4.00. |
This release of SAP will include the ability to release unused |
directory ALUs [clusters] back to the system. Also, I have |
received a number of requests that SAP provide optional sort |
orders for the directory other than the Name/Extension order |
currently used. Although I personally feel that the |
Name/Extension order is the best physical order for the |
directories and that there are many fine programs available that |
allow the directory to be displayed in any order, SAP 4.00 will |
provide these optional additional orders. |






 December 28, 2017  Add comments

Leave a Reply