Search Tools Links Login

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?

Original Author: Sebastjan Dobnik

Inputs

damadged file on floppy

Returns

restored file on your local disk

Code

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: empDamadgedFile.dat" For Binary As #2   'copy of damadged file (in my case in folder C: emp)
  
  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: empDamadgedFile.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

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 80 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.