Net Encryption Library
Secure Directory Erase
Basic Tasks > Secure Directory Erase

Secure Directory Erase Overview

The secure directory erase will overwrite each file using the selected algorithm, change the file length to zero, change the file date to 1/1/2034, and rename the file to a random file name.  In this way not only the data is overwritten but it will be impossible to see the length, date, or name of the file.

 

Here are the supported secure erase algorithms:

 

C# Copy Code
Encryption encryption = new Encryption(); //Trial Mode
//Encryption encryption = new Encryption("place user name here", "place license key here"); //License Mode
 
string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestDirectory");
Directory.CreateDirectory(path);
 
string testFile = Path.Combine(path, "testfile.txt");
File.WriteAllText(testFile, "This is a test");
 
encryption.SecureDirectoryErase(path,"*.*", SearchOption.AllDirectories, SecureEraseAlgorithm.Dod7);
 
bool directoryExists = Directory.Exists(path);
Console.WriteLine("Directory Exists: {0}", directoryExists);
VB.NET Copy Code
Dim encryption As New Encryption() 'Trial Mode
'Encryption encryption = new Encryption("place user name here", "place license key here"); //License Mode
 
Dim path As String = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestDirectory")
Directory.CreateDirectory(path)
 
Dim testFile As String = System.IO.Path.Combine(path, "testfile.txt")
File.WriteAllText(testFile, "This is a test")
 
encryption.SecureDirectoryErase(path,"*.*", SearchOption.AllDirectories, SecureEraseAlgorithm.Dod7)
 
Dim directoryExists As Boolean = Directory.Exists(path)
Console.WriteLine("Directory Exists: {0}", directoryExists)