Advertisement
1_2002 Debugging and Error Handling #106887

Restore data from damadged flopy

Have U ever saved something on the flopy that could not be retrived due 2 damadged floppy? U insert flopy and try to copy damadged file. Explorer stops saying: "CANNOT READ DRIVE A:" and even ScanDisk cannot repair errors on disk. Well, you could try my VB solution to this problem. It is very easy, effective, and it works. Ok, output file has some errors, but it is beter to have 99% of your data retrived than 0. Don't u agree?

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
Private Sub Command1_Click()
  Dim Buffer As String
  Dim Location As Single
  Dim Lenght As Single
  Dim ErrCount As Single
  
  
  Open "a:\DamadgedFile.dat" For Binary As #1     'the file that is damadged
  Open "c:\temp\DamadgedFile.dat" For Binary As #2   'copy of damadged file (in my case in folder C:\temp)
  
  Lenght = LOF(1)
  
  On Error Resume Next
  Buffer = Space(1)
  
  For Location = 1 To Lenght
    Get #1, Location, Buffer
    If Err <> 0 Then
      ErrCount = ErrCount + 1
      Debug.Print "ERROR no.: " + Format$(ErrCount) + ". Cannot read data on location" + Format$(Location)
      Buffer = " "  'change damadged data with space
      Err.Clear
    End If
    Put #2, Location, Buffer
  Next
  Close
  x = MsgBox("Done")
  End
  
  'Go to c:\temp\DamadgedFile.dat" and try to open it...
  'most Word, Excel, CDR, jpg, bmp, ..... and other file tipes will open with no
  'significant errors in the content...
  '
  'Well, hope this helps u restore your data...
  
End Sub
Original Comments (3)
Recovered from Wayback Machine