CSAP - Sort And Pack Directories Version: 4.2.3 Date: July 21, 1995 Authors: Don A. Williams & Edgar Swank **************************** NOTICE! ************************** * Contrary to the current trend in MS-DOS software this * * program, for whatever it is worth, is NOT copyrighted * * (with the exception of the runtime library from Borland * * International's Turbo C)! 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 systems, * * particularly: * * * * Inn on the Park [PCBOARD] * * (602) 957-0631 1200/2400/9600 * * The Wish Book [PCBOARD] * * (602) 252-4472 1200/2400 * * Technoids Anonymous [PCBOARD] * * (602) 899-4876 300/1200/2400 bps * * * * All can be reached through PC Pursuit. * * * * or: * * on CompuServ: 75410,543 * * * * 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. * ***************************************************************** CSAP is a program to sort PC/MS-DOS directories in any of three orders and to write out the sorted directory. It is a replacement for my earlier SAP which was written in assembly language and had a number of nasty bugs! CSAP, from version 2.0.2 up, supports all of the options provided by SAP 3.01, however, the manner of specification and the defaults are different. CSAP, from version 3.0.0 up, supports MS-DOS 4.xx and DR DOS 3.xx large partitions. Also, beginning with version 3.0.0, CSAP provides the optional ability to truncate directories, i.e. return disk space not used by a directory to the free disk space. **** WARNING **** Due to the fact that CSAP alters the directories and, if the new "truncate directories" option is selected, the FATs on the disk, it should NOT be executed out of a "shell" or in a multi-tasking environment! 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, CSAP will assume that the disk is a system disk and will exclude the first two files from the sort. USAGE CSAP [options] [directory_name] or CSAP [directory_name] [options] Both parameters are optional and, if neither is specified, CSAP will sort the current directory and all elements in the directory tree below it in ascending order on the "Name" field. As did SAP, CSAP will sort all subdirectory entry so that they fall ahead of any file entries. The directory_name parameter, if supplied, specifies to CSAP the directory with which to start the sort. Unless otherwise instructed, CSAP will sort that directory and all directories below it in the directory hierarchy. If no disk is specified in the path name, CSAP 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 a '/', CSAP will assume that the path starts at the root directory. If the path name does not begin with a '\'or a '/', 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. With version 2.1.2, CSAP will accept either the '\' or the '/' characters as separators in path specifications. The options provide the user with a means of controlling the sort order. They are as follows: -F "Freeze". Do not sort except for subdirectory entries and deleted files. -N Sort on entry Name and Extension(the default). -E Sort on entry Extension then Name. -D Sort on entry Date/Time. -S Sort on entry Size. -I Invert the sort order, i.e sort in descending order. -L Sort only one level of the hierarchy. -R Report the number of removed "deleted"entries and the sector addresses of the directory. -P Do not remove "deleted" entries [reversed from SAP]. -V Verify (request permission from the operator) before sorting each directory. -T Truncate directories, i.e. return unused disk space to the free space pool. -Z Zero out unused entries (leading zero byte). The case and order of the options is not important and they can be specified individually, i.e. CSAP -d -i or combined, i.e. CSAP -di EXAMPLES: Following are some simple examples of the use of CSAP: 1. A>CSAP This form of the CSAP command (with no command line parameters) will sort the "current" directory of the "current" or "default" disk (disk A in this example) and all directories below it in the hierarchy. The directories will be sorted in name order and "deleted" entries will be removed. 2. A>CSAP -V This form of the CSAP command is the same as in 1. except that CSAP will pause for user confirmation before sorting each directory. 3. A>CSAP \ This form of the CSAP command will sort the "Root" directory of the "Current" disk, in ths example, A:\. All directories on disk A would be sorted. 4. A> CSAP \ -L This form would, again, sort the "Root" directory of disk A but the "-L" option would limit the sorting to just the "Root". 5. A>CSAP \ -R This form of the CSAP would sort all directories on disk A and show, for each directory, the relative sectors occupied by the directory and the number of "erased" entries removed. 6. A>CSAP \ -DR This form of the CSAP command will, again, sort all of the directories on disk A but this time in Date/Time order. The "R" option would, again, cause the relative sectors occupied by each directory and the number of entries removed to be displayed.