* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * R E N A M Z * * * * A ZCPR3-Compatible File Renaming Utility * * * * * * by * * Terry Hazen * * 21460 Bear Creek Road * * Los Gatos, CA 95030 * * (408) 354-7188 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Latest Revision --------------- Version 1.5 - 05/06/88. See RENAMZ15.HIS for revision details. ================================================================= Overview -------- RENAMZ is an enhanced Z80 file renaming utility for use with ZCPR3 and CP/M 2.2 or ZRDOS. RENAMZ has not been tested with CP/M 3.0. RENAMZ was designed as a general purpose file renaming utility as well as a companion to ACOPY. It can help reduce the ALIAS command line length required to rename groups of files with unrelated names by optionally renaming only those files that have been tagged with any combination of the file attributes F1 through F7 (rename if ANY of the selected attributes are set). Files may be tagged using the ZRDOS utility SFA (Set File Attributes) or a similar CP/M Public Domain utility such as DA. RENAMZ also has a number of other options which are described below. RENAMZ can also 'move' files between different user areas as well as rename them at the same time if you specify the desired new user area as part of the new filename. Any drive specified for the new filename will be ignored, however. RENAMZ is fully ZCPR3 compatible when operating in a ZCPR3 environment, accepting both the DIR: and the DU: forms and checking the environment to obtain the maximum drive and user that will be accepted, whether it is to be operating in a quiet environment, and the name under which the program was called for use in the HELP message. RENAMZ will operate correctly using the GO command. Errors will cause the ZCPR3 program error flag to be set. When operating in a ZRDOS environment, files in the PUBLIC areas are protected. When RENAMZ operates in a non-ZCPR3 environment, the required information is obtained from internal locations, which may be patched as described below. RENAMZ will not accept the DIR: form when operating in a non-ZCPR3 environment. Installation ------------ The distribution version of RENAMZ is supplied with an AMPRO standard Z3ENV address of FE00H. ZCPR3.0 users with other Z3ENV locations should install RENAMZ using Z3INS.COM and SYS.ENV in the normal manner. No installation is required for operation in ZCPR3.3 or non-ZCPR3 environments. Syntax ------ RENAMZ supports the use of both CP/M (destination=source) and MS- DOS (source destination) syntax by scanning the command line for an '=' and defaulting to MS-DOS syntax if it is not found. The syntax is: RENAMZ [dir:]OLDafn [dir:]NEWafn [/option(s)] or RENAMZ [dir:]NEWafn=[dir:]OLDafn [/option(s)] Files can only be renamed to new filenames on the same drive, so RENAMZ will ignore any drive specification for the new filename. Specifying a different user number for the new filename will cause the old filename to be renamed to the new filename and 'moved' to the new user area. If either dir: specification is not supplied, RENAMZ will assume the default drive and user. Both A0>renamz filename.typ b11:newfile.typ and A0>renamz b11:newfile.typ=filename.typ will rename the file A0:FILENAME.TYP to A11:NEWFILE.TYP (note that the drive 'B' specification for the file newfile.typ is ignored). The command A0>renamz b11:filename.typ will move the file A0:FILENAME.TYP to user 0, the default user. A renamed file will normally retain all its attributes except that the archive attribute will always be reset (marked as changed). If a file is renamed to the same name as an existing file, it will take on the attributes of the existing file. Wildcards --------- Both source and destination filenames may contain wildcards. Source file wildcards are expanded in the usual way. RENAMZ attempts to resolve destination file wildcards by a matching process in the same manner as ACOPY does. For example: A0>renamz a1:renamz.z80 ??????10.* will result in a renamed filename of RENAMZ10.Z80. Clearly, this process may result in the creation of duplicate files. RENAMZ attempts to eliminate duplication by storing the name of the last file renamed and comparing it to the name of the file currently being renamed. If they match, RENAMZ prints a Duplicate! error message, and the current file is skipped. If two files with the same names are not renamed in sequence, a duplicate filename may still be created. Care should be exercised in using destination file wildcards, but thoughtful use will allow more flexible single-step renaming with minimal typing. Options ------- RENAMZ has a number of command line options, which must be preceded by the option flag character '/'. The option letters or numbers may appear in any order and may appear anywhere in the command line. Options may be combined in any combination. Options are toggled as they are read, so that an option appearing twice will cancel itself. All of the following command lines have the same meaning: A0>renamz /12q source.ext dest.ext A0>renamz source.ext dest.ext /1 /q /2 A0>renamz /12 dest.ext=source.ext /q A0>renamz /q /q source.ext /q dest.ext /21 The options are: I - Inspect option. Displays each proposed rename and asks for operator approval before proceeding. The default is to automatically rename files without asking provided that the new filename doesn't already exist. O - Overwrite option. Deletes existing R/W files with the same name as the new filename without asking. Normally, you are asked first. R - R/O option. Deletes existing R/O or R/W files of the same name as the new filename without asking. Normally, you are asked first. S - Skip option. Skips renaming if files of the same name as the new filename already exist. Normally, you are asked first. Either the O (Overwrite) or the R (R/O) option will override the Skip option if both are specified. N - Renames only non-archived (changed) files. The archive option, as used under ZRDOS, allows you to limit renaming to non-archived files (those files that have been opened or modified since the archive attribute was set). This option is useful in 'moving' changed files to another user area on the same disk. Under CP/M 2.2, the archive attribute is not reset when a file is updated, so the archive option is not too useful unless you use a utility program to 'manually' set or re-set the archive attribute. 1 - 7 options. Renames only those specified files which also have the selected combination of the F1 through the F7 attributes set. The files will have the same attributes as before. Q - Quiet option. Turns off non-error messages. Any information you should know about during the renaming process, such as error information, is still displayed. Will not overwrite any existing files unless the O or R options are also used. When operating in a ZCPR3 environment, the Q option initial setting will automatically be set according to the state of the ZCPR3 QUIET flag. If the Q option has an initial setting of ON, the use of Q in the command line will then toggle the Q option OFF. The HELP screen will automatically display the proper meaning of the Q option. Optional RENAMZ Modifications ----------------------------- RENAMZ has several locations near the beginning of the program that can be patched using DDT, PATCH, ZPATCH, etc, to alter the operation of the program to suit the user. The following table lists their locations and the distribution defaults. Since RENAMZ was written to help shorten ALIAS command lines, it will probably be re-named by the user to a shorter name. If you are operating in a ZCPR3 environment, just rename the program as desired. The name by which the program was invoked will automatically appear in the HELP message, and no patching need be done. If you are primarily operating in a non-ZCPR3 environment, the program name, 'RENAMZ', at location 010BH-0112H, may be patched to any desired new name, which will then appear at the proper places in the HELP message when it is called. A maximum of eight characters are available. Fill the unused character positions with space characters, as spaces in any of the eight locations will be ignored. For example, to change the name of the program from RENAMZ to NAMZ, you may simply patch the 'RE' in 'RENAMZ' to space characters (20H) and the HELP message will then display 'NAMZ' with no leading spaces. The option flag and the default option characters may be changed if you prefer other mnemonics. The changed characters will automatically appear in the HELP message. The options are all OFF-ON toggles. The default settings for the options may be changed from OFF (00H) to ON (0FFH) to allow, for example, always inspecting files before renaming without having to use the /I option. Note that if you then use the /I option, it will turn OFF the automatic inspection. If you change the option default settings by patching, the HELP message will automatically try to reflect these changes. Since changing some of the default option settings may change the operation of RENAMZ by removing some of the built-in safety factors that help prevent overwriting important existing files by accident, caution should be exercised in changing any of the default option settings! If it is desired to eliminate ALL option choices following a given option, patch the FIRST undesired option letter or number to a 00H (for example, to eliminate the F1-F7 options, change the F1 byte at 0123H from '1' to 00H). All subsequent option choices will no longer operate. When RENAMZ steps through a number of files, it may generate more than a screenful of display. To help summarize what has happened, RENAMZ displays the total number of files renamed on completion of the program. If you prefer not to have this display, patch location 011AH from FFH (display total number of files renamed) to 00H (no display). Location Default Purpose ================================================================ 010BH 'RENAMZ ' Program name (8 characters maximum) -0112H - Appears in HELP message 0114H '/' Option flag character 0115H 10H Maximum drive allowed (A=1H, P=10H) 0116H 0FH Maximum user area allowed (15D=0FH) 0119H ON (FFH) Display the number of files renamed 011AH 'I' Inspect option character 011BH OFF (00H) Inspect default setting 011CH 'O' Overwrite R/W file option character 011DH OFF (00H) Overwrite R/W file default setting 011EH 'R' Overwrite R/O & R/W files option character 011FH OFF (00H) Overwrite R/O & R/W files default setting 0120H 'S' Skip renaming existing files option character 0121H OFF (00H) Skip option default setting 0122H 'N' Non-archive option character 0123H OFF (00H) Non-archive default setting 0124H '1' F1 attribute option character 0125H OFF (00H) F1 attribute default setting 0126H '2' F2 attribute option character 0127H OFF (00H) F2 attribute default setting 0128H '3' F3 attribute option character O129H OFF (00H) F3 attribute default setting 012AH '4' F4 attribute option character 012BH OFF (00H) F4 attribute default setting 012CH '5' F5 attribute option character 012DH OFF (00H) F5 attribute default setting 012EH '6' F6 attribute option character 012FH OFF (00H) F6 attribute default setting 0130H '7' F7 attribute option character 0131H OFF (00H) F7 attribute default setting 0132H 'Q' Quiet option character 0133H OFF (00H) Quiet option default setting ================================================================