* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * A C O P Y * * * * An Enhanced ZCPR3-Compatible * * File Copy Utility * * * * Copyright (c) 1986-90 * * by * * Terry Hazen * * 21460 Bear Creek Road * * Los Gatos, CA 95030 * * * * Voice.......... (408) 354-7188 * * Saratoga RBBS.. (408) 354-5934 * * Zee-Machine.... (408) 245-1420 * * Ladera Znode... (213) 670-9465 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Lastest Revision ---------------- Version 3.0 - 02/16/90 Adds source and destination disk directory caching in RAM for faster copying, two new options Should now run under CP/M 3.0. See ACOPY30.HIS for revision history. ================================================================= Overview -------- ACOPY (Attribute COPY) is an enhanced Z80 file copy utility for use with CP/M 2.2 or 3.0, or ZCPR3 CCP's running under CP/M 2.2, CP/M 3.0, Z80DOS, ZRDOS, ZSDOS/ZDDOS and other extended DOS's. ACOPY, originally based on David Jewett, III's PPIP12, was developed as a fast, general purpose file copy utility with flexible command line option control over many aspects of the copy process, and more specifically to help simplify the command line script required to copy groups of files with unrelated names to a RAM disk. It does this by optionally copying 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 the ZRDOS utility SFA (Set File Attributes) or a similar CP/M Public Domain utility such as DA. Another option allows copying only directory and not system files. See the 'Options' section for information on the rest of ACOPY's command line options. ACOPY automatically supports DOS datestamping when it operates under CP/M 3.0, Z80DOS or ZSDOS. See the 'DOS Datestamping' section for more information. ACOPY 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 the program was called by for use in the command line HELP message. ACOPY will operate using the ZCPR3 GO command. Errors will cause the ZCPR3 program error flag to be set. When ACOPY 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 ACOPY.PAT. ACOPY will not accept the DIR: form when operating in a non-ZCPR3 environment. Disk Directory Caching ---------------------- ACOPY30 adapts the ideas developed by Hal Bower in his SPEEDUP disk directory buffer RSX to cache both source and destination disk directories in RAM for extra fast copying. All references to source and destination disk directory entries, up to a maximum of 256 entries per directory, are made to the cached RAM copies, eliminating the time required to move the disk drive head to the directory track, read the required directory record and then move the head back each time a directory reference is required. All references to directory entries not in the RAM cache are made to the physical disk directories as usual. When the copy process is completed, all changed cached source and directory directory records are then written back to the appropriate disks. While actual file copying times are very hardware and system dependent, directory caching can significantly improve copying speeds, especially when using floppy disks. ACOPY30 performed a specific 18 file/204k floppy disk file copy test 43% faster than ACOPY22, 34% faster than ACOPY22 running under SPEEDUP and 31% faster than ACOPY22 while doing datestamping under ZSDOS. See ACOPY30.HIS for more test information. Installation ------------ The distribution version of ACOPY is supplied with a Z3ENV address of 0000H, ready for use in ZCPR 3.3+ environments. ZCPR 3.0 users should install ACOPY 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 ACOPY.PAT, although the default values should be satisfactory for most users. Syntax ------ ACOPY supports the use of both CP/M (destination=source) and MS- DOS (source destination) syntax. The command line syntax is: ACOPY [dir:]source [[dir:]dest] [excluded] [/option(s)] or ACOPY [[dir:]dest=][dir:]source [excluded] [/option(s)] Both A0>acopy filename.typ b11: and A0>acopy b11:=filename.typ will copy the file FILENAME.TYP from A0 to B11. When only one filename is given, it assumed to be the source file, and will be copied to a destination file of the same name on the logged drive. For example: B11:SAMPLE>acopy work:filename.ext will copy the source file WORK:FILENAME.EXT to a file of the same name on B11:SAMPLE. Excluding Files --------------- You may sometimes wish to copy a group of files specified by a filename/attribute mask which also includes some files you don't want copied. You can optionally add a third filename mask to specify files that you wish to exclude from copying, 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 destination file specification, such as the destination drive, user, or *.*, so that you have specified all three filenames in some way. For example: A0:WORK>acopy util:filename.* a: *.doc will copy the files UTIL:FILENAME.*, except for DOC files, to files of the same names on A0:WORK. Wildcards --------- Source, destination and exclusion filenames may all contain wildcards. Source and exclusion filename wildcards are expanded in the usual way. ACOPY attempts to resolve destination file wildcards by a matching process. For example: A0>acopy acopy.z80 b:??????30.* will result in a destination filename of ACOPY30.Z80. Since it is possible that this process may result in the creation of duplicate files, ACOPY stores the name of the last file copied and compares it to the name of the file currently being copied. If they match, ACOPY prints a 'Duplicate!' error message, and the current file is skipped. If two files with the same names are not copied in sequence, a duplicate filename may still be created. Care should be exercised in using destination file wildcards, but if you are careful and aware of the limitations of the process, you can do copying and renaming of multiple files in one step with minimal typing. File Attributes --------------- New destination files will normally have the same filename attributes as the source files. If a destination file overwrites an existing file of the same name, the new file will take on the attributes of the previous file. Destination files will normally be marked as changed (not archived). To help set up RAM disks, however, the 'D' option may be used to mark destination files as archived. Source files may be archived after the files have been copied by using the 'S' option. This helps you back up files and mark the sources as archived in one step. Destination files are normally set as directory files. The 'Y' option allows the option of copying files and setting them as system files in one step, a useful ability when loading RAM disk workspaces. See the 'Options' section for more information. DOS Datestamping ---------------- When ACOPY detects that it is operating under CP/M 3.0, Z80DOS or ZSDOS, it takes advantage of the appropriate extended DOS calls to automatically copy the source file datestamps, if they exist, to the destination file datestamps so that destination files have the same creation and modification dates as the source files. There is also an associated 'C' option that allows you to suppress datestamp copying, if desired, so that destination files are dated as newly created. When operating under other DOS's, this option is not active and does not appear in the command line HELP message. See the 'Options' section for more information. When operating under ZSDOS, successful datestamping is indicated by displaying '(Dated)' in the copying status message. No datestamping message will be displayed when datestamping support is not present, when there is a datestamping error, or when datestamping is done under Z80DOS. Destination Disk Free Space --------------------------- ACOPY checks to make sure that enough free space for the destination file exists on the destination disk before attempting the copy. If a file to be overwritten already exists on the destination disk, its size will be allowed for and it will not be deleted unless there will be in enough free space for the new file on the disk after the deletion. If insufficient space exists, ACOPY will display a 'Disk too full!' message in the copying status message, the ZCPR3 program error flag will be set to 7 and the console bell will be sounded. If a wildcard source filename was specified, ACOPY will continue to step through the list of source files, copying any files that will fit and giving error messages for each file that won't. Even if you use the 'O' or 'R' option to specify automatically overwriting existing files, no destination disk file will be deleted unless doing so will create enough space to allow copying of the replacement file. If you are in the QUIET mode and attempt to copy a file to a disk that doesn't have enough free space, ACOPY will cancel QUIET operation, as you will probably be interested in which files could be copied and which couldn't. This will give you the information you need to take appropriate measures, such as changing disks and repeating the command, or erasing enough files on the destination disk to create enough free space for the files you still want to copy. ACOPY can also help you 'pack' a backup disk. It will look at each specified file, checking whether there is space for it on the destination disk, and copying it if there is. It doesn't quit when it first finds insufficient space, but continues to look for files small enough to fit, and copys those that will. The ACOPY 'S' option (archive source files after copying) can mark as archived those files successfully copied, and you will be able to copy only the uncopied (and non-archived) files to another backup disk using the ACOPY 'N' option (copy only non- archived files). A sample command line for backing up files is: A0>acopy *.* b: /nos which will copy all non-archived (changed) files on A0: to B0:, automatically overwriting destination files of the same name and archiving the source files after copying. Options ------- ACOPY 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>acopy /12qr source.ext dest.ext excluded.ft A0>acopy source.ext dest.ext /1 /r excluded.ft /q /2 A0>acopy /12 dest.ext=source.ext excluded.ft /rq A0>acopy /rq /q source.ext /q dest.ext /21 excluded.ft Individual options may be inactivated by setting the high bit of the option letter (adding 80H to the letter) or by just patching it to 80H or higher. When an option is inactivated, it won't appear in the command line help message and it can't be selected. The 'A' and 'Y' options, for example, are normally inactivated, as most users won't require them. An inactivated option may be reactivated by patching the option letter back to the capitalized option letter you have selected to specify the option. Also, if you patch any option letter to 00H, ALL subsequent options will be inactivated. The following descriptions of the options reflect the default option settings in the distribution version. You may change the default option settings to suit your own needs by patching. See ACOPY.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 options are: 1 - 7 options. Copies 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 copying. In this case, the operating system will prevent you from creating more than one PUBLIC file of the same name on a disk. If you try copying a PUBLIC file to a different user area, ACOPY will tell you that it already exists. If you try to overwrite the 'existing' file, the DOS will prevent it by aborting with a File W/P BDOS error. N - Copies only NON-archived (changed) files. The source file is archived after the copy is completed. Under ZRDOS, ZSDOS and other extended DOS's, the 'N' option allows you to limit copying to non-archived files (those files that have been opened or modified since the archive attribute was set). The destination files are created as non-archived files unless the 'D' option is selected to archive the destination files. 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. A - Normally inactivated by making option letter 'A'+80h (C1h) and set to ON to allow normally copying of both directory and system files. Option may be activated by patching for users wanting to normally copy only directory and not system files. When enabled and set to OFF, selecting the 'A' option allows copying of both directory AND system files, otherwise only directory files are copied. X - Skips copying if destination files of the same name already exist, without asking. Normally, you are asked first. Either the 'O' (Overwrite) or the 'R' (R/O) option will override the skip option if both are specified. O - Overwrites R/W destination files of the same name without asking. Normally, you are asked first. R - Overwrites R/O (or R/W) destination files of the same name without asking. Normally, you are asked first. M - Moves files. Deletes the source files when the copying operation has been successfully completed and displays 'Source Deleted' in the status message. Y - Normally disabled by making option letter 'Y'+80h (D9h). Option may be enabled for users wanting to set destination files as system files. When enabled, selecting the 'Y' option sets destination files as system files, otherwise sets destination files as directory files. C - Controls whether the source file datestamps will be copied to the destination file datestamps when operating under Z80DOS or ZSDOS (default is to copy datestamps). When operating under other DOS's, this option is inactive and will not appear in the command line HELP message. If datestamps are copied, the destination files will have the same creation and modification dates as the source files. If datestamp copying is suppressed, destination files will be dated as newly created. D - Sets the archive attributes in the destination files, marking them as archived. Speeds copying to RAM disks by copying and marking the copies as archived in the same operation. No message is displayed in the status line. S - Sets the archive attributes in the source files after copying, marking them as archived and displays 'Source Archived' in the status message. V - Turns CRC verification off (default is to always verify copies.) May be patched so that verification is normally off, in which case the 'V' option turns it on. Q - Quiet. Usually used in alias environments, the 'Q' option turns off non-error status messages. Any information you should know about during the copying process, such as error information, is still displayed. No existing files will be overwritten unless the 'O' or 'R' options are also used. If you attempt to copy a file to a disk which doesn't have enough free space while in the QUIET mode, ACOPY will cancel QUIET operation so that you can view subsequent status information. 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 ------------------------ ACOPY sets the ZCPR3 program error flag, if it exists, when an error occurs during program operation. For more flexible use in alias and ZEX scripts, ACOPY follows the convention set by Rick Charnes by setting the error flag to the following values for the indicated error conditions: 7 = Destination disk too full to copy the current file 8 = User abort 9 = Destination disk directory full 0FFH = Fatal error (which will terminate ACOPY operation) Optional ACOPY Modifications ---------------------------- ACOPY has a number of 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. See ACOPY.PAT for further information. ACOPY.PAT may also be assembled to an overlay file and overlaid on ACOPY30.COM to create a custom copy of ACOPY.COM. ACOPY in Alias Scripts ---------------------- When a ZCPR3 alias script is used to copy a large number of files with unrelated filenames, the command line may quickly become longer than the command line buffer. F1-F7 filename attribute tagging helps group the files by the desired function, allowing shorter and faster alias scripts. Specifying files to be copied by both filename masks and attributes can be useful, for example, when copying files from a disk containing a large number of software development utilities to a RAM disk. An alias script can be written to copy only those files necessary for 8080 assembly language work, and another alias script written to copy only those necessary for Z80 assembly language work. The source files may be tagged so that several single copy aliases will copy different subsets of the same group of source files. For example, all 8080 development files might have the F2 attribute set, all Z80 development files might have the F3 attribute set, all the necessary text processing files might have the F4 attribute set, and all desired general utility files might have the F5 attribute set. You can then copy a complete 8080 work utility file set from drive F0: to drive A0:, skipping those files where the destination files already exist, and mark the destination files as archived, with the script: A0>acopy f:*.* /245xd and a complete Z80 work utility file set, except for .DOC files, may then be similarly copied and archived with the script: A0>acopy f:*.* a: *.doc /345xd Acknowledgements ---------------- ACOPY was developed to suit my own special needs based on David Jewett, III's well-written and documented PPIP12, a very nice piece of work! PPIP has been further updated by Jay Sage and others to support Z-system and datestamping operation. I refer interested users to the latest version of PPIP for further information. The disk directory buffering scheme used in ACOPY30 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. And special thanks, also, to all you ACOPY users whose suggestions, comments and bug reports and testing contributions have been very helpful!