ZSWEEP - A Z System Disk Maintenance Utility. Pete Pardoe R.R.# 3 Truro N.S. Canada B2N 5B2 .he ZSWEEP - A Z System Disk Maintenance Utility I N D E X Page Introduction ........................ 1 Overview of ZSWEEP ............. 2 Invoking ZSWEEP ................ 2 Command Structure .............. 3 Single file commands ................ 4 Help ........................... 4 Forward and Backward ........... 5 Exiting ........................ 5 Finding a file ................. 5 Go to a File ................... 6 Viewing and Printing ........... 6 Deleting a file ................ 6 Copying ........................ 7 Renaming ....................... 7 The Space command .............. 8 The Log command ................ 8 The Psuedo Z system Prompt ..... 9 Introduction to Multifile Commands .. 9 The Tag command ................ 9 Wildcard tagging ............... 10 The Untag command .............. 10 The Mass copy command .......... 10 After the mass (Again) ......... 11 Erasing files .................. 11 Squeezing and Unsqueezing files. 11 Setting file status ............ 12 Epilogue ............................ 12 Credits ............................. 12 .PN1 Introduction ZSWEEP is a disk utility that is built from NSWP207. It all began when I was unhappy with the way that NSWP displayed WordStar files (it did not like soft hyphens and ^O's and a few other characters) and disassembled the program in order to patch it to display them correctly. Over the years I continued work on the disassembly and finally got it to the place where I was able to add to the code with no ill effects. When I finally migrated to the Z system I missed many of the functions of NSWEEP and decided to tackle the conversion of it to the Z system. Since then I have converted it to Z80 code from 8080 as the Z system does not run on anything other than a Z80 or compatible processor. The program as configured requires ZCPR 3.3 or greater with an extended TCAP as it uses some code from VLIB4D for the opening screen. It gets the screen size and highlighting information from the environment and installs the information at run time. If you desire to add more highliting information such as underline to the hilite string, you may do so. The begin hilite string is 12 bytes begining at 309EH followed by 12 more for the end hilite string at 30AEH. They are signalled by 'BEGIN>' and 'END>' just before each string. You will need to know the length of your hilite and end hilite strings and place the additional bytes following. ZSWEEP will place the first string in place for you from the environment. The entire string must not be more than 11 bytes as the 12th must be a null (00H) to signal the end of the string. The other features changed from the original program are the use and display of the directory names from the NDR, the correct display of WordStar files, the ability to use either CP/M or WS arrow keys to move back and forward in the file list, the ability to abort with ^C or X, to use J as a synonym for F and the ability to run the COM file or perform a command upon the file pointed to by ZSWEEP and finally the ability to run any command line you wish from within ZWSEEP. ZSWEEP can be renamed to whatever name you prefer as it discovers the name it was invoked by from the Z system environment. I hope that you enjoy this program, and use it well. Any problems, or suggestions may be directed to myself at the address on the first page, or voice at: (902) 895-7252 Disclaimer and warning While this program has been tested on many systems, neither Dave Rand nor I will accept any liability or responsibility to the user or any other person or entity with respect to any liability, loss or damage caused, or alledged to be caused directly or indirectly by this program, including, but not limited to, any interruption of service, loss of business, anticipatory profits or consequential damages resulting from the use of this program. Furthermore, although this program has been placed into the public domain, I along with Dave Rand retain all copyrights to this program, world wide, and pursuant to this, this program MAY NOT BE SOLD BY ANY PARTY unless specifically authorized by the authors, in writing, prior to the first copy being sold. As well, this program MAY NOT BE INCLUDED IN ANY OTHER PACKAGE FOR SALE, even if this program is indicated as being 'in the public domain'. All of the above applies to both the original as well as derived, or modified copies of the original. Any modified copies of this program MUST NOT have the copyright notice violated, changed or altered. Please report any copyright violations to the author. ZSWEEP Overview ZSWEEP is a directory and file manipulation program. With it, you can copy, delete, rename, unsqueeze, squeeze files and run other programs. The most important thing to remember when using ZSWEEP is that it provides a list of your files in ALPHABETICAL order. Moving around in this list is quite easy, and will soon become second nature. In this documentation, all user input is in boldface letters. As well, when the "current" file is referenced in this documentation, it means the file just to the left of your input. This "current" file is often referred to as the file you are "on". Invoking ZSWEEP To make effective use of ZSWEEP, you must know the various options available to you when you invoke ZSWEEP. Here are some of the options: A>ZS This format simply loads ZSWEEP, and scans the default drive and user for filenames. Once inside ZSWEEP, you may change to a different drive and/or user, but when you exit you will be returned to the directory that you called ZSWEEP from. A>ZS *.COM This format loads ZSWEEP and scans the current drive and user for all filenames with the extension '.COM'. Note that ZSWEEP can find system files as well, so no additional information need be given. A>ZS B:*.COM * The presence of the second asterisk indicates to ZSWEEP that you wish to scan all user areas of the indicated disk drive. In this case, all *.COM files on all user areas on drive B. Combinations of the above are acceptable, and you may even log to all user areas, and find all files with the specification '*.* *'. You may also invoke ZSWEEP using named directories ROOT> ZS WORDSTAR:*.COM Once inside ZSWEEP you are presented with a menu, then a report of which drive and user you are logged to, how much space is taken by the files you have specified, how many files have been found with the specifications given, and how much space is left on the disk. A sample follows: Drive A0/WORDSTAR:????????.??? 596K in 36 files. 735K free. A special format of this line shows that you are logged to all user areas: Drive B*/NO NAME:????????.??? 950K in 234 files. 2956K free. From this point, you may execute any of the menu options. A special display occurs if no files are found with the specification you have given, or if there are no files in the given directory/drive/user area(s): No files. This display may also occur if you delete all the files out of a given specification. When this occurs, your menu choices are limited to ONLY 'H' 'S', 'L' or 'X'. This allows you to get the Help screen, see the free Space on a drive, to Log to another directory/drive/user, or to eXit. No other choices are valid, nor will they be accepted. Command Structure There are two primary types of commands in ZSWEEP: those that act on one file and those that act on many files. We will go through them both. Before doing that though, let's try moving around in ZSWEEP first. To move in ZSWEEP, you must first understand that the files on your selected directory will be presented to you in a sorted manner. The files are sorted in this order: Filename, File extension, user area: 1. B0: -WORK .001 0K : 2. B0: ARCADD .COM 4K : 3. B0: ARCCOPY .COM 2K : As you can see, the files are numbered for your convenience. You may not directly use these numbers. As well, the file size is also shown (rounded to the nearest block size). Note that if you have enabled the reverse video sequence (see Epilog), you may see some of the letters in the filename printed in reverse video. The chart below shows how to decode this information. FFFFFFFF RSA 12345678 /YR |||||||| OSC 4. B0: ARCDEL .COM 2K : As you can see, this looks confusing. Really, though, it is not. The tags F1-F8 normally are not used, but ZSWEEP allows you set F1-F4 for your own use. The R/O tag means that the file may be read, but not written to. The SYS tag means that the file does not appear in normal DIR listings, and in CP/M 3, MPM and CP/M 86 also means that this file is available to all user areas. The ARC tag means that, if set, the file has been backed up since it was last accessed. Now that you understand how files are presented, we can go through a sample session. Remember, user input is in boldface letters. A>ZS B: +--------------------------------------+ | | | ZSWEEP - Version 1.0 04/04/91 | | | | (c) Pete Pardoe 1991 | | Portions (c) Dave Rand 1983, 1984 | | | +--------------------------------------+ Drive B0/WORK :????????.??? 850K in 64 files. 118K free. 1. B0: -WORK .001 0K : 2. B0: ARCADD .COM 4K : 3. B0: ARCCOPY .COM 2K : 4. B0: ARCDEL .COM 2K : 5. B0: ARCDIR .COM 2K : B 4. B0: ARCDEL .COM 2K : B 3. B0: ARCCOPY .COM 2K : B 2. B0: ARCADD .COM 4K : B 1. B0: -WORK .001 0K : X Single File Commands Help At any point, you may request the main help menu by pressing '?'. 1. B0: -WORK .001 0K : ? +--------------------------------------+ | | | ZSWEEP - Version 1.0 04/04/91 | | | | (c) Pete Pardoe 1991 | | Portions (c) Dave Rand 1983, 1984 | | | +--------------------------------------+ A - Retag files | Q - Squeeze/Unsqueeze tagged files B or up arrow - Back up | R - Rename file(s) C - Copy file | S - Check remaining space D - Delete file | T - Tag file for E,M,Q or Y E - Erase T/U files | U - Untag file F or J - Find file | V - View file G - GO to (Run) program | W - Wildcard tag of files L - Log new directory | X or ^C - Exit to Z system M - Mass file copy | Y - Set file attributes tagged files P - Print file | Z - psuedo Z system prompt. Return, space or Down Arrow - Forward one file Moving forward and backward As you can see, the two most common commands will be moving forward and backwards through the directory. Either the SPACE bar , or the RETURN key or the down arrow may be used to move forward. To move backwards simply use the 'B' key or the up arrow. Note that all commands in ZSWEEP can be either in upper or lowercase. Internally, lowercase will be converted to uppercase. If you reach the end of the directory with either command, you will be "wrapped around" to the other end automatically. Exiting To exit, just use ^C or the 'X' command as shown above. This will return you to the same drive and user area that you invoked ZSWEEP from, regardless of anything you may have done in ZSWEEP. Finding a file Since you may have many hundreds of files selected, you may wish to move rapidly to a particular file. You may do this through the 'F', or FIND command. The 'J' is accepted for a synonym for 'F' for those accustomed to ZFILER 1. B0: -WORK .001 0K : F Which file? BASCOM 8. B0: BASCOM .COM 32K : The Find command always starts looking from entry number one. You may use the standard CP/M syntax for wildcarding (eg: to find the first .HEX file, you may use *.HEX), and also note that the Find command will fill all blank spaces with question marks. This makes the search strings 'B*.*', 'B', and 'B??????.' all find the first file beginning with 'B'. As you experiment, you will find other interesting uses for this command. At this point, you now know how to move through your directory, both rapidly and one step at a time. Let's move on to some more useful commands. Go to File You may temporarily leave ZSWEEP to perform other tasks with an automatic return to the exact spot you left off with the 'G' command. If the file you GO to is a COM file you will see the 'tail?' prompt to which you may respond with whatever information you wish to feed to the program (file name, options etc.) If the program is not a COM file you will be asked 'Command to perform on file?' to which you may respond with the COM file that you wish to have act upon this file. For example: 41. A0: Z3PLUS .COM 16K : 42. A0: Z3PLUS .LBR 28K : G Command to perform on file? LGET Tail? DEFAULT.Z3T Notice that once you have given the name of the command that you wish to perform You will see the 'Tail?' prompt to which you may respond with whatever file names or options you wish. Once the command has been performed you will see 'Strike any key --' which you may do as soon as you have viewed whatever information may have resulted from the command. Once you strike the key you will be returned to the exact place where you left off in ZSWEEP. Viewing and Printing a file The View command, invoked with a 'V', will type the current file onto the screen unsqueezing the file if required. Note that this command will NOT prevent you from listing ANY type of file, so you must use your own judgment on what can and cannot be listed. At the end of each page on the screen, view will stop, and allow you to abort the viewing with a ^C or a ^X. To get one more line from the file, hit the space bar. To get another page, hit the or RETURN key. The Print command, invoked with a 'P', will send the current file, with no modifications or paging, to the current LST: device. You may abort the print with a ^C or ^X. All other features of the View command apply. Deleting a file You can delete the current file just by hitting the 'D' key. Before deletion occurs, you will be prompted. 12. B0: CDP1 . 40K : D Delete file? Y 12. B0: DEAD .DAT 100K : If any reply other than 'y' or 'Y' is given, the file is not deleted. If the file is deleted, it is removed from the list and the next file is given the current file's number. If the file is a Read Only file, you will be prompted again: 12. B0: CDP1 . 40K : D Delete file? Y R/O. Delete? Y 12. B0: DEAD .DAT 100K : Copying a file While on any file, you may copy that file to: A. Another name, on the same directory/drive/user B. Another name, on a different directory/drive/user C. The same name, on a different directory/drive/user ZSWEEP will prevent you from copying a file to the same directory/drive/user that the source file resides on. Other than that, there are no restrictions on where you wish the file to be. If a file exists on the same directory/drive/user that you wish to place the destination file, the existing file is deleted automatically, even if it is Read Only. When ZSWEEP copies a file, all the attributes of the original file are passed on to the destination file. Thus, if a file is a SYS, R/O file, ZSWEEP will cause the destination file to be SYS, R/O after the file copy has taken place. 12. B0: CDP1 . 40K : C Copy to (filespec)? C9:BACK.CDP If you wish to preserve the name of the file, you may just enter the destination directory or drive/user part of the filespec (eg. C9: In the preceding example would have copied the file to drive C user 9, retaining the name CDP1). Just entering the drive part of the filespec causes ZSWEEP to retain the user number of the source file. You may also use named directory references if you prefer, just remember that all copy operations must be followed by a colon ':' or the file will be copied to a file of that name in the current directory. If the filename is followed by a space, then a 'V', the file will be verify read after it is written. ZSWEEP maintains a CRC of the file as it is writing the file, and verifies this CRC. Renaming files The Rename command ('R') may be used to: A) Change the name of one file B) Change the names of many files C) Change the user number of one file D) Change the user number of many files To just change the name of one file, the syntax is simple: 12. B0: TEST1 . 40K : R New name, or *? TEST2 12. B0: TEST2 . 40K : You may also change the user number/directory of the file, as follows: 12. B0: TEST1 . 40K : R New name, or *? B1:TEST1 or 12. B1: TEST1 . 40K : R New name, or *? WORK:TEST1 Note that if all user areas are not specified in the logon of ZSWEEP, the file may not be shown on your list when renaming to another user area. To change a group of files from one name to another, you may enter the following command at any file: 9. B0: BASIC .COM 24K : R New name, or *? * Old name? *.HEX New name? *.BAK At this point all files with the extension .HEX will be renamed to the same filename but with the extension .BAK. You will see a running display on the screen as each file is renamed. Any valid wildcard may be used to select the source files, and the destination files will take one character from the source for each '?' in the name. An asterisk qualifies as filling the remainder of the field with '?'. If the destination file exists, the rename is not made. You may also choose to rename a group of files to another user area, optionally changing their names as well: 9. B0: BASIC .COM 24K : R New name, or *? * Old name? *.HEX New name? B1:*.BAK This command will rename all .HEX files on drive B user 0 to the same filename, but with the extension .BAK, and place the resultant file in user1. You may want to try this command a few times to get the hang of it, but it is extremely powerful. The Space command The Space command 'S' simply asks you for a drive code, then tells you the remaining space on the drive you specify (you may also use named directories here). Before doing the space check, a drive reset is performed, so feel free to change disks. The Log Command The Log command 'L' allows you to change your directory to another drive or user. Additionally, it allows you to re-specify the wildcard mask just like entering the ZSWEEP program from the Z system. As well, the drive system is reset, so again you should be able to change to a different diskette at this point or to another part of the same diskette. Named directory references may be used with this command as well. 16. B0: DD .COM 4K : L New directory/mask? A14:*.HEX +--------------------------------------+ | | | ZSWEEP - Version 1.0 04/04/91 | | | | (c) Pete Pardoe 1991 | | Portions (c) Dave Rand 1983, 1984 | | | +--------------------------------------+ Drive A14/NO NAME :????????.??? 144K in 2 files. 1118K free. 1. A14:ZSWEEP .SRC 72K: The Psuedo Z System Prompt ZSWEEP will allow you to enter and run any command line you choose so long as it does not exceeed 127 characters. The command to invoke the psuedo Z system prompt is the 'Z' command. Once it has run your command line you will be returned to ZSWEEP at the exact location you left it i.e. pointing at the same file number as when you left. 41. A0: Z3PLUS .COM 16K : 42. A0: Z3PLUS .LBR 28K : Z D0:ASSEMBLY>PWD PWD, Version 2.0 DU : DIR Name DU : DIR Name DU : DIR Name DU : DIR Name ---- -------- ---- -------- ---- -------- ---- -------- A 0: WORDSTAR A 1: OUTTHINK B 0: LETTERS B 1: TEXT Introduction to Multifile Commands Now that all the commands that affect single files have been described, it is time to introduce the concept of Multifile commands. These commands are ones that affect as few as one or as many as all of the files on a single disk. To affect these files, though, we must have some way of describing which files need to be affected. CP/M has a way to do this, using "wild cards". This program, on the other hand, uses the concept of a file "tag". The Tag command Tagging a file, in its simplest form, can be accomplished just by depressing the 'T' key when the file to be tagged appears. What exactly is a tag? A tagged file is a file in the list of filenames that has an asterisk next to the colon after the name of the file, as shown below. 9. B0: BASIC .COM 24K :* A tagged file is different from an untagged file in that you may now request an operation that deals with several unrelated files (eg., Files that will not match using only one wildcard). A sample"tag" session is shown: 9. B0: BASIC .COM 24K : T Tagged files = 24K ( 23K). 10. B0: BRUN .COM 16K : T Tagged files = 40K ( 39K). Note that the 'T' command automatically performs a "move forward" operation. To the right of the 'Tagged files' message two numbers are displayed. The numbers are the total size in K, of the files you have tagged so far. This is useful if, for example, you are moving files from one size of diskette to another, smaller, size diskette. If the source disk holds 500K, and the destination holds 256K, you can stop the tagging operation when your size is just less than 256K. The tag function in itself does not perform any operation, other than to mark the file for a future "mass" operation. By now the astute reader will notice that I have cleverly skipped over the function of the second number display, the one in parenthesis. This number is the combined size of the tagged files, IN 1K BLOCKS. If you are using a computer system that supports many different disk sizes/formats, or a system with a hard disk attached, you may already know that CP/M can allocate storage only in "BLOCKS", and that these "BLOCKS" may be up to 16k in length. This means that ZSWEEP would show a file containing say, 512 bytes in information, as being up to 16k long, depending on the block size of your disk. The second number in the tag display shows how much storage the cumulative files would take if they were stored on a diskette with 1K blocks which is the lowest common denominator. Wildcard tagging Another way to tag files is the wildcard tag function. This function accepts a CP/M type wildcard and proceeds to tag all the files that match the wildcard. To invoke this, just hit 'W' and you will be prompted with the message 'Which files? ' Enter any CP/M wildcard, right down to a unique filename, and if that file exists it will be tagged and displayed. Untagging files If you can tag a file, you must be able to Untag a file as well. 9. B0: BASIC .COM 24K :*U Tagged files = 16K ( 16K). 10. B0: BRUN .COM 16K :* As you can see, the untag function subtracts the current file's size from the total then displays the total of the remaining files. The Mass Copy Command Now that we have a number of files "tagged", what do we do with them? Well the Mass copy function is one of those that acts on many files. Its purpose is to copy the tagged file(s) from one directory to another. 12. B0: CDP1 . 40K : M Copy to? WORK: V Copying --> B0: BRUN .COM to B1: with verify Verifying --> file ok. The 'V' is optional, and it indicates that you wish to have the file verified after it is written. As you can see, the files have been sent to drive A, user 14. If you wish the tagged files to reside in the same user area as the source files after the copy, do not specify a user area in the Mass command. This will cause ZSWEEP to put the file in the same user area as the source file. ZSWEEP will not allow you to copy a file to the same drive and user area as the source. The copy is simply not made. Named directories may also be used for the mass operations if you prefer. After the Mass After any mass file operation, the tags are "reset" as each file is copied. Visually, they change from a '*' to a '#'. The files are logically untagged, and will respond as such. But, since ZSWEEP remembers them, you can automatically retag these files. This is useful if, for example, you need to copy the same files to a number of different diskettes or user areas on a drive. To invoke this, use the 'A' command. 12. B0: CDP1 . 40K : A Retagging--> B0: BRUN .COM Tagged files = 16K ( 16K) Erasing Files You may want to copy a group of files, then delete them from the source disk after the copy has been made. To do this, you can use either the 'C' command to copy, followed by the 'D' command, which is tedious, or a combi nation of the 'T', 'M', 'A', and the 'E' commands. The 'E' command Erases tagged or untagged files at your option, on a global scale. 12. B0:CDP1 . 40K : E Erase Tagged or Untagged files (T/U)? T Do you wish to be prompted (Y/N/A)? N Deleting --> B0: BRUN .COM If you specify Untagged files, the untagged files will be erased. You may wish to be prompted before each file is to be deleted, and you can do this via the second question or you may Abort the request to delete. Squeezing and Unsqueezing files The 'Q' command allows you to Squeeze and Unsqueeze tagged files. This file squeeze program is compatible with the original squeeze/unsqueeze programs written in the 'C' language by Richard Greenlaw. After hitting Q, you will see the prompt: Squeeze, Unsqueeze or Reverse (S/U/R)? After answering this skill-testing question, you will be asked which directory/drive/user you wish to place the destination files. The syntax here is the same as for the Move command, except it is permissible to 'Q' the files back to the same directory/drive/user that they originated. When 'Q' is invoked, you are asked if you wish to Squeeze, Unsqueeze or Reverse. A carriage return here will return you to the command line of ZSWEEP. If you select 'S' for Squeeze, all tagged files will be examined to see if it is "worth" squeezing them. Files that exhibit ANY space reduction, even if it is only one sector, will be squeezed. If the file is not "worth" squeezing it will simply be copied to the destination directory/drive/user. If you select 'U' for Unsqueeze, all tagged files will be examined to see if they are squeezed. If they are, they will be unsqueezed, and moved to the destination directory. If they are not squeezed, then they are simply copied. If you select 'R' for Reverse, all files that are squeezed will be unsqueezed, and all files that are unsqueezed will be squeezed (if it is worth it), and moved to the destination directory. The most attractive feature of the 'Q' command in general is the ability to Squeeze files ONLY if it is "worth" it. This means that by using ZSWEEP, you can archive data into the absolute minimum amount of space possible. The SQ algorithm used in ZSWEEP is better than the one in the original 'C' squeezer, and produces the smallest output file possible with current technology. The file squeezer section was done by Jim Lopushinsky, and is copyrighted separately by him. He also has a public domain stand alone squeezer. Setting the Tagged Files Status You may set the attributes of a group of tagged files just like STAT, or PROT. To do this, tag the files and select the 'Y' command. 12. B0: CDP1 . 40K : Y Which flags (1-4,R,S,A)? R,S Setting ---> B0: BRUN .COM to R/O SYS The flags you may set are the F1-F4 flags, as well as the Read Only, System, and Archive (MP/M, CP/M 3 only) flags. Any flags you do not specify will be reset. To reset all the flags (i.e., Change to R/W, DIR and no "Sysop tag") just enter a single comma or space at the "Which flags" prompt. Note that the flags in the "Which flags" question do not have to be entered with a comma between them, as anything (or nothing at all!) will do. As far as the program is concerned 'RSA', 'R S A', and 'R,S A' are all valid. Epilogue All the functions of ZSWEEP have now been described. The best way to get more familiar with the program is to actually USE it. I think it will be one of your most frequently used programs just as it once was under CP/M. If you think of anything that you feel would be especially useful to have in the program please forward your suggestions to me and I will consider them. I am presently working on changing the squeeze sections to Cruncn as it acheives better compression and is becoming more popular as well as the ability to move into a library and act upon the files in it just as in disk mode. Credits Thanks to Dave Rand who authored the original NSWEEP program, to Bruce Morgan who is working on NZCOM compatibility (particularly user areas 16-31) as I am only able to test it on my system which is a Z3PLUS system, to Ian Cottrell who also assisted me with Beta Testing, to the author's of the Z system under which the program runs and finally to the authors of all the fine libraries for the Z system. I am releasing the program to the public domain with the kind permission of Dave Rand to whom we all owe a debt of gratitude for the original program. This file has been created from NSWEEP207.DOC and so I express my gratitude as well to Dave McCrady who prepared the original file and also gave his kind permission for its modification. April 5, 1991 Truro N.S. Canada