Use the Sysinternals sdelete.exe command to securely delete files:
-p option to
specify the number of passes to overwrite the disk segments. The
more passes, the less likely the file can be recovered.
-s option can be used
to recursively delete everything within a folder:
> sdelete -p 4 -s c:\logs
' This code runs the sdelete command ' ------ SCRIPT CONFIGURATION ------ strCommand = "sdelete -p 5 c:\logs\tue.log" ' ------ END CONFIGURATION --------- set objWshShell = WScript.CreateObject("WScript.Shell") intRC = objWshShell.Run(strCommand, 0, TRUE) if intRC <> 0 then WScript.Echo "Error returned from running the command: " & intRC else WScript.Echo "Command executed successfully" end if
When you delete a file through Windows Explorer, it is sent to the Recycle Bin. You can use the Recycle Bin to restore the file to its original location or you can permanently delete the file by emptying the Recycle Bin. But wait a second—the file doesn't really get deleted when you empty the Recycle Bin. All that happens is that the link to the collection of bits on the hard disk that make up the file is deleted. The bits that make up the file are still present on the disk. And it stays like this until the file system overwrites those bits with a new file. That means that if a bad guy stole your computer, he could run a program to examine the hard drive and restore files that have been previously deleted and not overwritten. That is, unless you securely delete the file using the Sysinternals Sdelete program. Sdelete works by writing random characters to the bits that made up the file before. This prevents programs from piecing the file back together. This doesn't prevent someone from restoring a previous copy of the file from backup, but someone won't be able to take the hard drive and restore a deleted file on which you used Sdelete.