* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * R E N A M Z * * * * A ZCPR3-Compatible File Renaming Utility * * * * * * Copyright (c) 1986-91 * * by * * Terry Hazen * * 21460 Bear Creek Road * * Los Gatos, CA 95030 * * * * Voice.......... (408) 354-7188 * * Zee-Machine.... (408) 245-1420 * * Ladera Znode... (213) 670-9465 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Latest Revision --------------- Version 1.8 - 01/14/91 See RENAMZ18.HIS for revision details. ================================================================= Overview -------- RENAMZ is an enhanced Z80 file renaming utility for use with CP/M 2.2, CP/M+, or ZCPR3 CCP's running under CP/M 2.2, CP/M+, Z80DOS, ZRDOS, ZSDOS/ZDDOS or other extended DOS's. RENAMZ was developed as a fast, general purpose file renaming utility with flexible command line option control over many aspects of the renaming process. It can help reduce the ALIAS command line length required to rename groups of files with unrelated names. It does this by optionally renaming only those files that have any of the specified filename attributes (the high bits of the filename and filetype bytes) F1 through F7 set. Filename attributes may be set using a ZCPR3 utility such as DFA (Display/Define File Attributes) or a similar CP/M Public Domain utility such as DA. See the 'Options' section for information on the rest of the RENAMZ command line options. 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 DU: forms and checking the environment for the validity of the drive and user specified, whether it is to be operating in a quiet environment, and the name under which the program was called for use in the command line HELP message. RENAMZ will operate using the GO command. Errors will cause the ZCPR3 program error flag to be set. When operating in a ZRDOS environment, PUBLIC files are protected unless specifically referenced. When RENAMZ operates in a non-ZCPR3 environment, the required information is obtained from internal locations, which may be patched to suit your system as described in the file RENAMZ.PAT. RENAMZ will not accept the DIR: form when operating in a non- ZCPR3 environment. Disk Directory Caching ---------------------- RENAMZ can be configured so that it caches the disk directory in RAM to speed up the renaming process when it runs under CP/M 2.2- compatible systems. Because CP/M+ handles directory operations differently, directory caching is automatically turned off when RENAMZ runs under CP/M+. RENAMZ is distributed with directory caching turned off, but it may be activated by using ZCNFG or by direct patching. See RENAMZ.PAT for more information. RENAMZ18 adapts the ideas developed by Hal Bower in his SPEEDUP disk directory buffer RSX to cache the disk directory in RAM for fast renaming when using slow media like floppy disks. All references to the disk directory, up to a maximum of 256 entries, are made to the cached RAM copy, eliminating the time required to write each changed disk directory record to disk each time a rename is performed. All references to directory entries not in the RAM cache are made to the physical disk directory as usual. When the renaming process is completed, all changed cached disk directory records are then written back to disk all at once. Renaming using disk directory caching is most effective with floppy disks, but can also be slightly faster with RAM disks and hard disks. With hard disks with large and crowded directories, however, it may not provide much advantage. It is also not as effective when datestamper-type datestamping is being done, as the required accesses to the !!!TIME&.DAT file offset much of the time saved on directory accesses. If you routinely use datestamper datestamping, caching may not provide much advantage. Installation ------------ The distribution version of RENAMZ is supplied with a Z3ENV address of 0000H, ready for use in ZCPR33+ environments. ZCPR30 users should install RENAMZ using their regular installation methods. No installation is required for operation in non-ZCPR3 environments. However, several locations affecting program operation may be patched as described in the file RENAMZ.PAT, although the default values should be satisfactory for most users. Syntax ------ RENAMZ supports the use of both CP/M (newfilename=oldfilename) and MS-DOS (oldfilename newfilename) syntax. The command line syntax is: RENAMZ [dir:]oldafn [dir:]newafn [excluded] [/option(s)] or RENAMZ [dir:]newafn=[dir:]oldafn [excluded] [/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 B11:FILENAME.TYP to B0: (user 0, the default user number.) A renamed file will normally retain all its filename attributes. However, if a file is renamed to the same name as an existing file, it will take on the attributes of the existing file. Normally all renamed files are considered 'changed' and are marked as non-archived, but the use of the 'D' option will archive all renamed (destination) files as an aid in some file backup operations. The 'D' option may also be set to normally ON by patching if you prefer renamed files to be normally archived. See RENAMZ.PAT for more information. Excluding Files --------------- You may sometimes wish to rename a group of files specified by a filename/attribute mask which also includes some files you don't want renamed. You can optionally add a third filename mask to specify files that you wish to exclude from renaming, even if they otherwise match the source file specification. Note that if you choose to specify it, the exclusion filename must be the THIRD FILENAME specified. The exclusion filename is a filename mask only, and any drive/user specified will be ignored. In situations where you would normally only need to specify the source filename, and you also wish to specify an exclusion filename, you must provide at least a minimum renamed file specification, such as the user number for the renamed files, or *.*, so that you have specified all three filenames in some way. For example: A0:WORK>renamz a2:filename.* 0: *.doc will rename the files A2:FILENAME.*, except for DOC files, to files of the same names on A0:WORK. Wildcards --------- Source, renamed and exclusion filenames may all contain wildcards. Source and exclusion filename wildcards are expanded in the usual way. RENAMZ attempts to resolve renamed filename wildcards by a matching process. For example: A0>renamz a1:file.z80 ??????10.* will result in a renamed filename of FILE10.Z80. Since it is possible that process may result in the creation of duplicate files, RENAMZ stores the name of the last file renamed and compares 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 renamed file wildcards, but if you are careful and aware of the limitations of the process, you can do renaming of multiple files in one step 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. For example, all of the following command lines have the same meaning: A0>renamz source.ext dest.ext excluded.ft /12q A0>renamz source.ext dest.ext /1 /q /2 excluded.ft A0>renamz /12 dest.ext=source.ext excluded.ft /q A0>renamz /q /q source.ext /q dest.ext /21 excluded.ft Except for the attribute options (1-7), individual options may be disabled if you'd rather not have them available. See RENAMZ.PAT for more information. The following descriptions of the options reflect the default option settings in the distribution version. You may change the default option characters or settings to suit your own needs by patching. See RENAMZ.PAT for more information. The command line HELP screen will automatically display the proper selection message for each option based on whether it has been set to ON or OFF. The default options are: 1 - 7 options. Renames only those specified files which also have the selected combination of the F1 through the F7 attributes set. Under Z80DOS and ZSDOS, where PUBLIC files have the F2 attribute set, you can also use the '2' option to select only PUBLIC files for renaming. If you try renaming a PUBLIC file to a different user area, RENAMZ will tell you that it already exists and will prevent overwriting the 'existing' file by aborting with a File W/P BDOS error. N - Renames only NON-archived (changed) files. The source file is archived after the renaming is completed. Under ZRDOS, ZSDOS and other extended DOS's, the 'N' option allows you to limit renaming to non-archived files (those files that have been opened or modified since the archive attribute was set). The renamed files are marked as non-archived unless the 'D' option is selected to archive the renamed files. This option is useful in 'moving' only 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 this option is not too useful unless you use a utility program to 'manually' set or reset the archive attribute. X - Skips renaming if the new filenames already exist. Normally, you are asked first. Overridden by either the 'O' (Overwrite) or the 'R' (R/O) option. O - Overwrites R/W destination files of the same name without asking. Normally, you are asked first. Overridden by the 'I' (Inspect) option. R - Overwrites R/O (or R/W) destination files of the same name without asking. Normally, you are asked first. Overridden by the 'I' (Inspect) option. 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 filenames don't already exist. Overridden by the 'Q' option or the ZCPR3 QUIET flag. D - Sets the archive attributes in all renamed (destination) files, marking them as archived (not changed.) Normally, renamed files are marked as non-archived (changed.) No message is displayed in the status line. This option can be useful in file backup operations where files on a backup disk can be renamed to a new 'backup' name and archived at the same time before being replaced with the latest version of the file. Q - Quiet. Usually used in alias environments, the 'Q' option turns off non-error status messages. Any information you should know about during the renaming process, such as error information, is still displayed. No existing files will be overwritten unless the 'O' or 'R' options are also used. Overrides the 'I' option. When operating in a ZCPR3 environment, the 'Q' option state will automatically be set according to the state of the ZCPR3 QUIET flag, no matter how the default option setting is patched. ZCPR3 Program Error Flag ------------------------ If the ZCPR3 program error flag exists, RENAMZ sets it when an error occurs during program operation. For more flexible use by alias and ZEX scripts using flow control, RENAMZ follows the convention set by Rick Charnes by setting the error flag to the following values for the indicated error conditions: 0 = Program operation successful - no errors. 8 = Program abort - user abort command. 0FFh = Program abort - fatal error. Optional RENAMZ Modifications ----------------------------- RENAMZ has a number of locations near the beginning of the program that can be patched using ZP, ZPATCH, DDT, etc, to alter the operation of the program to suit the user. RENAMZ.PAT may also be renamed, assembled to an overlay file and overlaid on RENAMZ.COM to create a custom copy of RENAMZ.COM. ZCNFG17.COM and the configuration file RENAMZ18.CFG may also be used to change some of RENAMZ.COM's more common user-configurable settings. See RENAMZ.PAT for further information. Acknowledgements ---------------- The disk directory buffering scheme used in RENAMZ18 is adapted from the core code of Hal Bower's great SPEEDUP disk directory buffer RSX contained in SPEEDUP.LBR. The operation of SPEEDUP is described in Hal's LINKPRL article in The Computer Journal, issue #41.