Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Excel VBA macro intended to write garbage files to hard drive.
- 'Objective is to see how well this "cleans" a hard drive, meaning increases difficulty to recover deleted files.
- 'So far looks okay but use at your own risk (i.e. if you have serious data to wipe don't
- 'just trust some macro you found on Pastebin!
- 'Saving as txt files to reduce potential harm and not slow down virus scans
- '150 text files covers about 5 gigs.
- 'updated Aug 2020 to use arrays. Improves speed by about 3x.
- Sub WriteOverDeletedSpace()
- Const RoundsOfSaves As Long = 10
- Dim theClock As Double: theClock = Now
- Const PathFileText As String = "C:\Users\???????\Downloads\!Clutter\Junk\"
- Dim wkbk As Workbook, r As Long, c As Long, z As Long
- Application.ScreenUpdating = False
- Set wkbk = Workbooks.Add
- For z = 0 To RoundsOfSaves
- 'Number of columns
- c = 200
- r = 49999
- ReDim theArray(1 To c, 1 To r) As Double
- For x = 1 To c
- For y = 1 To r
- theArray(x, y) = VBA.Rnd * 65535
- Next y
- Next x
- wkbk.Sheets(1).Range("A1").Resize(r, c) = theArray
- wkbk.SaveAs Filename:=PathFileText & Round(Evaluate("=value(NOW())") * 1000000000, 0), FileFormat:=xlCurrentPlatformText
- wkbk.Sheets(1).UsedRange.ClearContents
- Next z
- wkbk.Close (False)
- Application.ScreenUpdating = True
- MsgBox "done in " & Round((Now - theClock) * 24 * 3600, 0) & " seconds."
- End Sub
Add Comment
Please, Sign In to add comment