VB icon

Restore data from damadged flopy

Email
Submitted on: 1/7/2015 10:03:00 AM
By: Sebastjan Dobnik (from psc cd)  
Level: Beginner
User Rating: By 4 Users
Compatibility: VB 3.0, VB 4.0 (16-bit), VB 4.0 (32-bit), VB 5.0, VB 6.0, VB Script, ASP (Active Server Pages)
Views: 1109
 
     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?

 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: Restore data from damadged flopy
' Description: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?
' By: Sebastjan Dobnik (from psc cd)
'
' Inputs:damadged file on floppy
'
' Returns:restored file on your local disk
'**************************************

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


Other 1 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.