markz@microsoft.UUCP (Mark Zbikowski) (07/18/84)
"...Is there a public-domain program that will "unerase" an accidentally deleted DOS file?..." It purely by accident that you can recover erased files. When DOS erases a file, it zeros the relevant clusters in the FAT and then marks the directory entry as being free. If (as some non-public domain programs attempt) you go and un-mark the directory entry, you *may* recover the first allocation unit only. Here are the list of difficult problems such a program would have to solve: o Reuse of the directory entry. Consider using wordstar and deleting a file. Wordstar may have done another create which *could* have reused the directory entry. Tough luck. o File is > 1 allocation unit. On single-sided floppies, this is 1 sector (512 bytes). On the XT hard disk, this is 8 sectors (4K). If you have done much work on the disk, the files will tend to be scattered. Also, there is NO guarantee that MSDOS makes as to the contiguity of files. Any reliable sort of recovery would need to scan the free allocation units and 'guess' at which ones belonged where in the recovered file. Tough luck again. o Reuse of freed allocation units. These now belong to another file. Tough luck finally.
mjg@ecsvax.UUCP (07/20/84)
To a limited extent you can recover a file if you have accidentally erased it providing you have not written anything else to the disk in the mean time. Erasing the file causes the first byte of the name to be zapped with a character (usually an E5 hex) which causes DOS to think it is not there. The directory entry contains a pointer to the 1st cluster of the file and to the entry in the FAT table which points to the next cluster which in turn points to the next cluster and so on. Now these entries are erased from the FAT table when you erase the file so on the face of it you only have information on the first cluster. HOWEVER, DOS normally allocates free clusters on a basis of taking the next free cluster starting from the lowest numbered one available. Therefore it is possible, knowing the length of the file and the first cluster to reconstruct the entire file. As I said, this is only if you have not written a new file to the disk since last time. If you have then all bets are off. Mike Gingell ...decvax!mcnc!ecsvax!mjg
markz@microsoft.UUCP (Mark Zbikowski) (07/24/84)
From uw-beaver!cornell!vax135!houxz!houxm!ihnp4!mit-eddie!lkk Wed Dec 31 16:00:00 1969 "... Erasing the file causes the first byte of the name to be zapped with a character (usually an E5 hex) which causes DOS to think it is not there. The directory entry contains a pointer to the 1st cluster of the file and..." I hate to be a spoil-sport, but relying on the contents of a directory entry that was deleted to contain meaningful information is going to cause you lots of problems. This is in the same boat as: Gee, the current OS is xK long. Therefore, I'll code my program to use the remaining (64-x)K. "... HOWEVER, DOS normally allocates free clusters on a basis of taking the next free cluster starting from the lowest numbered one available..." This statement is not only misleading, it is false. Under 2.0, if MSDOS is allocating a new file (note the key word new), it scans for free allocation units beginning at allocation unit 2. If the file *already* exists, it performs a bi-directional search beginning at the last allocation unit in the file to find a chain of free allocation units. Note that I have said "Under 2.0". There is absolutely no guarantee *anywhere* that this algorithm will be used in the future.
litvin@uiucuxc.UUCP (07/26/84)
#R:microsoft:-870000:uiucuxc:21900003:000:363 uiucuxc!litvin Jul 25 22:44:00 1984 .... It's not free, but reasonalby priced: Norton Utilites (~$55). It allows you to recover erased files among many other useful utilities that the good folks at Microsoft didn't include in DOS. A must buy for anyone wanting the easy capability to modify ANY byte on a diskette among other things. John Litvin A.I.S.S. University of Illinois (U/C)