Re: Deleting a file off a Drive, beyond kill
From: Peter (peter_at_mclinn.com)
Date: 08/18/04
- Next message: Nathan: "Loading numerous pictures"
- Previous message: Herfried K. Wagner [MVP]: "Re: ftp........"
- In reply to: Peter: "Re: Deleting a file off a Drive, beyond kill"
- Next in thread: Peter: "Re: Deleting a file off a Drive, beyond kill"
- Messages sorted by: [ date ] [ thread ]
Date: 18 Aug 2004 13:48:28 -0700
I found this on Planet Source Code. It is writen in vb6. I take it
that the binary read in vb6 grabs the exact bytes and the binary
reader in vb.net doesn't? What do you think of this code?
Function DeleteFile(Path As String)
'This is an extremely quick file delete
' developed
'by me in about 5 minutes.
'overwrites the file 21 times then delet
' es it
'clean off your disk :-)
Dim i As Integer 'variable For times To overwrite
Dim Data1 As String, Data2 As String, Data3 As String, Data4 As
String, Data5 As String, Data6 As String, Data7 As String, Data8 As
String, Data9 As String, Data10 As String, Data11 As String, Data12 As
String, Data13 As String, Data14 As String, Data15 As String, Data16
As String, Data17 As String, Data18 As String, Data19 As String,
Data20 As String
'^^^ all 20 data variables, which hold t
' he information to overwrite the file wit
' h
Dim FinalByte As Byte 'just a byte To Do the final overwrite With
Data1 = Chr(85) 'the variables information
Data2 = Chr(170) 'the variables information
Data3 = Chr(74) 'the variables information
Data4 = Chr(99) 'the variables information
Data5 = Chr(71) 'the variables information
Data6 = Chr(92) 'the variables information
Data7 = Chr(101) 'the variables information
Data8 = Chr(112) 'the variables information
Data9 = Chr(1) 'the variables information
Data10 = Chr(61) 'the variables information
Data11 = Chr(97) 'the variables information
Data12 = Chr(119) 'the variables information
Data13 = Chr(86) 'the variables information
Data14 = Chr(79) 'the variables information
Data15 = Chr(109) 'the variables information
Data16 = Chr(72) 'the variables information
Data17 = Chr(90) 'the variables information
Data18 = Chr(0) 'the variables information
Data19 = Chr(255) 'the variables information
Data20 = Chr(212) 'the variables information
Open Path For Binary Access Write As #1 'open the path so we can
overwrite it
For i = 1 To 10 'a Loop
Put #1, , Data1 'overwrite
Next i 'stop Loop
For i = 1 To 10 'another Loop
Put #1, , Data2 'overwrite
Next i 'stop Loop
For i = 1 To 10 'another Loop
Put #1, , Data3 'overwrite
Next i 'stop Loop
For i = 1 To 10 'another Loop
Put #1, , Data4 'overwrite
Next i 'stop Loop
For i = 1 To 10 'another Loop
Put #1, , Data5 'overwrite
Next i 'stop Loop
For i = 1 To 10 'Im sure you Get the point from here on!
'that this is just the overwriting stage
' !
Put #1, , Data6
Next i
For i = 1 To 10
Put #1, , Data7
Next i
For i = 1 To 10
Put #1, , Data8
Next i
For i = 1 To 10
Put #1, , Data9
Next i
For i = 1 To 10
Put #1, , Data10
Next i
For i = 1 To 10
Put #1, , Data11
Next i
For i = 1 To 10
Put #1, , Data12
Next i
For i = 1 To 10
Put #1, , Data13
Next i
For i = 1 To 10
Put #1, , Data14
Next i
For i = 1 To 10
Put #1, , Data15
Next i
For i = 1 To 10
Put #1, , Data16
Next i
For i = 1 To 10
Put #1, , Data17
Next i
For i = 1 To 10
Put #1, , Data18
Next i
For i = 1 To 10
Put #1, , Data19
Next i
For i = 1 To 10
Put #1, , Data20
Next i
For i = 1 To 10 'the final Loop
Put #1, , FinalByte 'the final overwrite
Next i 'stop final Loop
Close #1 'close the file
Kill Path 'delete it
MsgBox "All Done Wiping The File!", vbInformation + vbOKOnly, "All
Done!" 'duh
End Function
- Next message: Nathan: "Loading numerous pictures"
- Previous message: Herfried K. Wagner [MVP]: "Re: ftp........"
- In reply to: Peter: "Re: Deleting a file off a Drive, beyond kill"
- Next in thread: Peter: "Re: Deleting a file off a Drive, beyond kill"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|