The following code, used to "securely" delete a file, only works for
me on FAT16/32 drives, and not with NTFS drives. On FAT16/32 drives,
the file is overwritten with random data, but with NTFS, it's not
overwritten UNLESS I remove the DeleteFile command... Strange! That
is, if I leave DeleteFile in, then when I "undelete" the file with
PC File Inspector Recovery the file holds 1234567890, but if remove
DeleteFile then the file DOES contain random data. I can't see any
logical reason for this...

Code: Select all
a$="d:\aaaaaaaaaa.txt" ; D:\ is my NTFS drive.
;
If CreateFile(0,a$)
WriteString("1234567890")
CloseFile(0)
If OpenFile(0,a$)
For r=0 To Lof()-1
FileSeek(r)
WriteByte(Random(255))
Next
CloseFile(0)
DeleteFile(a$)
EndIf
EndIf
PB - Registered PureBasic Coder