February 4, 1991 COPIES.PRG ù Fast copy of files from one folder or disk to another! ù No danger of losing original files on disk due to a power outage! ù Copied files have same date and time stamp as original! ù First the list of files to be copied is made, then the copying is done, so that you can be away during the copying! ù Copy, move, or delete files! ù Abortion is acceptable! ù Wild characters can be used! ù Help is available! This program is fast, convenient, and reliable, and so, essential to anyone who works with files, program files or documents. Once you start using this program, you will realize that you simply cannot be without it. Introduction This is the copy program you have been waiting for! You will use this program more than any other program you own! Upon double-clicking on COPIES.PRG, a dialog box appears. Copy, Move, and Delete are clear. "Copy no Bak" copies the file without first copying it into a BAK file. This is faster, but the original file may be lost if there is a power outage. "Delete on D" deletes files on the ramdisk D. Usually an alert box will appear asking you to select the drive. This obviates the slow Atari drive replacement routines. You will then see the file selector asking you to choose the first file. If you did not choose "Delete", you will then notice that the menu will ask you for the file to be copied to. Following this, you give more files to be copied, terminating with "cancel". Use To copy D:\FILE1.DOC, D:\FILE2.DOC, D:\FILE3.TXT to A:\FILE1.DOC, A:\FILE2.DOC, A:\FILE3.TXT, you choose as the first file D:\FILE1.DOC. You choose as the second file, the name of the file to be copied to, A:\FILE1.DOC. The next selection will be D:\FILE2.DOC, followed by D:\FILE3.DOC. The program knows to copy all the files to the same directory (in this example, to A:\). If a file is present in the new directory, it will be rewritten, without an alert box asking if you want to rewrite the file. I feel that the alert box that appears in the GEM copy is a bother, in particular, if there are many files to be copied. So easy and nice. Nothing to it! Consider the standard GEM copy. You have to drag the file to the desired location. Sometimes the mouse slips, and you have to click on the file again. If the file exists in the new location, you have to respond to the alert box. If you want to copy a group of files, you have to first make a box. Again, the mouse can slip, requiring you to make the box again. In any case, you have to wait by the computer while the files are copying, to be able to reply to the alert boxes for each box. Significance I copied a file from the ramdisk to the floppy, using GEM. This file already was present on the floppy. During the file transfer, I shut off the computer. Upon rebooting, I found my file with size 0. This means that the normal GEM copy is dangerous. Previous to having COPIES.PAS, to prevent loss of files, I first copied to a temporary disk. The trouble is that I got mixed up between the files on the primary disk and the files on the temporary disk. Let us not laugh at this problem of reliable file transfers. Larger systems, like VAX-VMS or the CDC mainframe, simply create a new version (cycle) of the file, leaving the user the chore of cleaning up all the old cycles. COPIES.PAS solves the reliability problem, and, indeed, this was my primary motivation for writing the code. The program copies the file to a file with extension .BAK, and performs the rename only at the successful completion of the copy. This way, shutting off the computer during the file copy will not damage the file on the floppy. GOODIES There are other goodies to the program, besides the reliability. First of all, it is fast. I copied a file of size 315194 bytes from the disk to the ramdisk. GEM and COPIES.PRG both took 38 seconds. It is also faster because GEM performs a window redraw after copying each file, while with COPIES.PRG the window is redrawn only at the final completion of all the copying. Copying from ramdisk to various folders and disks involves many window redraws with GEM, while you sit and stare at your lovely monitor. COPIES.PRG saves you this time. COPYING GROUPS OF FILES It is very easy to create a group of files to copy. One way is to keep selecting files. There is no chance of the mouse slipping, as in GEM, requiring another selection. Alternatively, you can use wild characters. For example, to copy all the files of a folder, choose "*.*" as the file to be copied. Or choose "*.DOC" if you want all files with extension ".DOC" to be copied. If you want all files beginning with "SK", then choose "SK??????.DOC". Be sure to choose a file with wild characters as the first file of the group, for otherwise the wild character will be treated as an ordinary character. COPYING, MOVING, OR DELETING Moving means that the original file will be erased when the copy is done. The copied files will have the same date and time as the original files. Consider this example. I have a folder called "Pending", in which I keep files of letters I sent out, for which I have not yet received a reply. Upon receiving the reply, I move the file to another folder. Using GEM, I lost the information on the date the letter was sent, and was forced to look inside the file to find this out. Furthermore, moving files with GEM is very clumsy. You have to open two windows, one for the file and the other for the destination. After the copy, you have to delete the original. This is slow and error prone. It works beautifully with COPIES.PAS. ABORTION I have a file called "COPIES.PAS" in a folder "ACC". This is the source code of the accessory. I have another file "COPIES.PAS" in another folder, which is the source code of the program. I copied the file from the ramdisk to the folder ACC by mistake. The file that was there was lost. Fortunately, I had just make a backup on another disk. Now, with COPIES.PRG, this problem does not have to happen. As soon as you realize that you goofed, you hit any key. Any key is good enough -- you do not have the time to search for a specific key! Just hold down the key until the program exits. Your file will be untouched! You cannot abort in GEM, for as I mentioned above, shutting off the power will simply result in an empty file. SUMMARY What COPIES.PRG does, then, is make the copy process reliable. Reliability is the most important thing in programming. Of what value is there to an excellent editor, smart thinking, if you lose your files in the copy process? It surprises me that a very basic item like a good copy process should not have been available years ago, as part of GEM. ACCESSORY I made an accessory, which you can use, if you desire. However, for the 315194 byte file mentioned above, it took 1'30" to copy, which is much too slow. The reason is that the chunk size is much smaller in the accessory, to save memory. In general, the accessory takes up memory that cannot be released. Using the program in a ramdisk is very fast and efficient, and, of course, you can always delete the file COPIES.PRG from the ramdisk if you need the space. PROGRAM COMMENTS The program was written in Personal Pascal. The heart of the program is the GEMDOS programs $3F and $40, for reading and writing chunks of data from and to files. The program COPIES.PRG begins with creating a temporary file WORD.CPY for the list of files to be copied. This file is created on the ramdisk if possible. It is very fast to create this list, for all that is necessary is to select the files with the file selector. Hitting "CANCEL" signifies the completion of the list. The program then reads the list, and does its job. If wild characters, "*" or "?" were selected, then the program searches for all files satisfying the criteria, and writes these files in the list. If "delete" was selected, the job is very simple: The file "WORD.CPY" is read, and each file deleted. Otherwise, for each file, the date and time information is extracted. The new file is then created with this date and time, with extension ".BAK". The contents of the first file are then written to this file. At the completion of the copy, the file ".BAK" is renamed correctly. If "move" was selected, the original file is deleted. If the copy process failed, then the ".BAK" file is deleted, leaving the original file on the disk intact. Please send your contributions to: Dr. Sanford Aranoff 651 Greenwood Manor Circle West Melbourne, FL 32904 (407) 984-5400