RETRIEVING ACCIDENTALLY DELETED FILES - OR WHAT TO DO WHEN YOUR FAVOURITE PROGRAMME DISAPPEARS. --------------------- This is a very useful article for anyone who's ever lost a file (everyone?), and is a good introduction to getting deeper into the DOS file structure. The techniques here can be used by single-drive users with the help of the RAM disk as described. It has probably happened to all of us at one time or another, you are in the CLI and decide to delete a couple of files named TEST1 & TEST2 so you type DELETE TES#? and what happens, TEST1, TEST2 and TESTDRIVE all disappear. Easy to get rid of but how do you get TESTDRIVE back? Well what you have to do to recover your file or even a whole directory will depend on what you lost and how you lost it. What you will need are a few utilities as follow - DISKDOCTOR presently in the 'C' directory of your WORKBENCH disk may be a help, but I would strongly recommend you write to MegaDisc and order Fish 108 for a utility called SECTORAMA and also a copy of Amigan 16 which contains a utility called UNDELETE. As there are several ways you can lose files, I will deal with these separately with the possible cures as follows:- NOTE HOWEVER THAT IF USING DISKDOCTOR YOU SHOULD MAKE A COPY OF YOUR ORIGINAL DISK USING A COMMERCIAL DISK COPY PROGRAMME SUCH AS MARAUDER WHICH COPIES THE DISK EXACTLY AND WORK ON THAT COPY - YOU DON'T WANT TO TRASH THE WHOLE DISK DO YOU!! - FURTHERMORE, NOTHING IS LIKELY TO WORK IF YOU HAVE WRITTEN SOMETHING TO THE DISK FOLLOWING THE ACCIDENTAL ERASURE OF A FILE. 1. You have been using WORKBENCH and have decided you no longer need a certain file, so you drag the Icon over to the Trashcan and put it in the trash. You then decide you really needed the file - no problem, just click on the Trashcan Icon and there is your deleted file - the Trashcan is really just another directory to which you transfer files on their way to being deleted, they are not actually deleted until you perform the Empty Trashcan function from the WORKBENCH menu. 2. Another possible cause of lost files is when you drag an icon around on workbench to clean it up, and accidentally click the mouse when it is over another drawer icon, this causes the original icon file to disappear, but your file has only been transferred into the drawer, and doubleclicking on the drawer will resurrect your file. 3. Finally the most dangerous trap of all on the WORKBENCH is when using Extended Selection of Icons to say move 2 icons at once, you hold down the shift key and click on each Icon in turn. Unfortunately what the manual does not tell you is that if your mouse slips and you accidentally double-click on the button, your disk drive will run, and your Icons will disappear. Under some circumstances double clicking on an icon while the shift key is depressed causes the file or directory associated with the Icon to be deleted. On other occasions you may find your missing files have been erroneously transferred to the wrong directory. (It is always worth looking in all the drawers if something goes astray). To recover from this problem, see items 4 - 6 below. 4. TO RECOVER A SINGLE FILE CALLED "TESTDRIVE" Where a single file has been accidentally deleted, the easiest way to recover it is using "UNDELETE" on Amigan 16. This file should be copied into your "C" directory, or directly into RAM: which is the method I will demonstrate, assuming that only a single disk-drive is available. From the CLI with undelete in RAM: type UNDELETE TESTDRIVE RAM: (where RAM: is the device the file will be written to). You will receive a message telling you to put the disk in DF0: then press RETURN. UNDELETE will read the whole disk for a file called "TESTDRIVE" and if found will write it to RAM: with the block number appended. i.e. if found at block 950 it would be saved as RAM:TESTDRIVE.950. This is a safeguard if two files of the same name are on your disk. You can then save your found file back to the disk using the CLI statements: RENAME RAM:TESTDRIVE.950 AS RAM:TESTDRIVE COPY RAM:TESTDRIVE TO DF0: Where a whole directory has been deleted, the same procedure can be used for each file in the directory - but this assumes you can remember the names of all the files which is unlikely. If you know all the filenames in your deleted directory, then proceed as follows: From the CLI assuming the deleted directory was called "TESTFILES" issue the command MAKEDIR RAM:TESTFILES then proceed as above for single files except that the command for UNDELETE should be "UNDELETE TESTDRIVE RAM:TESTFILES/" which will cause the found files to be deposited in the RAM:TESTFILES directory - Once all the files have been found, you must rename them all as above then issue the following CLI commands:- MAKEDIR DF0:TESTFILES COPY RAM:TESTFILES TO DF0:TESTFILES ALL 5. If you do not remember the filenames in the deleted directory, then there are 2 courses open to you. First you can try DISKDOCTOR as in this paragraph or alternatively SECTORAMA as in paragraph 6. Personally I am very wary about using DISKDOCTOR as on a couple of occasions this programme has left me with completely useless disks, nevertheless on some occasions it will work and the procedure is as follows assuming you are using DF0: for your corrupt disk. Enter the CLI command DISKDOCTOR DF0: DISKDOCTOR will then read through your disk, and will usually find all files which have been deleted and are not overwritten and will list them in the Root Directory for you, it will also report on files it finds which have garbled data in them and will replace certain files. Here you may come up with a problem as I have found DISKDOCTOR has a habit of replacing good files with bad ones, and the last time I used it, I ended up with two "DEVS" directories, both different on the disk and with the DISK-VALIDATOR corrupt. However if you are working on a copy disk as I stated at the beginning and your missing files appear, you can now copy them to your original disk, and remember to FORMAT your copy disk before using it again. 6. USING SECTORAMA The version of this programme on Fish 108 is version 1.1, it is not yet finished and comes with somewhat scant documentation, however on a couple of occasions it has proved invaluable in retrieving files which I thought had been lost for ever. Assume once more that the Directory "TESTFILES" has been accidentally deleted, it contained 6 files and you remember one was called "TESTDRIVE" then proceed as follows: a) Enter CLI command MAKEDIR RAM:TESTFILES b) Run SECTORAMA DF0: - you will get a darkblue interlaced screen with light blue writing. The display will be of the Root Block of the disk in DF0: in this case the disk that had SECTORAMA on it. c) Put your corrupt disk in DF0: and type "R", and the display will be of the Root Block of your disk. d) Press the menu select button of your mouse, and go to the Sector Search menu and select item 1) Filename. You will get a requester in which you should enter TESTDRIVE and click on the OK button. e) SECTORAMA will then search the disk for the filename TESTDRIVE and if found you will have a "Longword" printed out at the top of the display e.g. 00000309 which is the block at which TESTDRIVE has been found. f) Move mousepointer to this longword and press the select button to highlight it, then type "J" to Jump to the block. g) You will now get a display of the first block of TESTDRIVE - You know that this file belonged to the directory TESTFILES, therefore pressing "P" will return you to the parent directory. If the directory has been deleted you will get a corrupt display, at the top of which will appear in place of the description "Directory" the word "Corrupt". Fortunately, SECTORAMA can cope with this, as you can now select the SECTOR SEARCH menu again, and select item 2) Parent Block, SECTORAMA will now search for all files which have the same "Parent", and give you a new list of "Longwords", and as there were 6 files in TESTFILES, you should now get a list of 6 Longwords representing the first block of each of the six files. h) Select the first Longword with the mouse, and type J to jump to it, you will get a display of the first file, the filename will appear 5 lines from the bottom of the second section of the display, e.g. TESTONE, select the save file menu, and for Open File Name type RAM:TESTFILES/TESTONE. Then go to the 2nd menu and select the "Write All" function, which writes the block and all subsequent blocks of the file into RAM: This can take quite a long time if the file is very long. i) Select the first menu again and close the file. j) Now type "L" to redisplay the "Last" sector search result - i.e. the display of the 6 Longwords in item "g" above. Now select the second longword and continue as in h) and i) above until all six files have been saved into RAM:. k) Finally you can now restore all the files to your disk with the commands:- MAKEDIR DF0:TESTFILES COPY RAM:TESTFILES TO DF0:TESTFILES ALL I know all this seems like a lot of work, however it is a lot easier than rewriting or repurchasing valuable programmes. There may be better ways to do it, and there are other DISKDOCTOR type programmes around, but most of these require two drives and I have set out to describe how you can do this on a single drive machine which is the equipment most of us will have. (And by the time you have got two drives, you should know how to resurrect files anyway!!). NOTE: As an alternative in item g) above, instead of instituting a search for files with the same "Parent Key", you can select the 3rd menu and pick the "Verify Directory" item, this will give you a list of all filenames in the deleted directory, and you can use UNDELETE to regain them - If one method does not work, then the other should. XXXXXXXXXXXXXXXXXXXXXXXXXXX END OF RECOVER_FILES XXXXXXXXXXXXXXXXXXXXXXX