Net Encryption Library
SecureDirectoryErase(String,String,SearchOption,SecureEraseAlgorithm) Method
Example 






KellermanSoftware.NetEncryptionLibrary Namespace > Encryption Class > SecureDirectoryErase Method : SecureDirectoryErase(String,String,SearchOption,SecureEraseAlgorithm) Method
File wildcard pattern
Recurse into sub directories
The algorithm to use to overwrite files
Securely erase files within a directory and sub directories according to the search pattern
Syntax
'Declaration
 
Public Overloads Sub SecureDirectoryErase( _
   ByVal directoryPath As System.String, _
   ByVal searchPattern As System.String, _
   ByVal searchOption As System.IO.SearchOption, _
   ByVal algorithm As SecureEraseAlgorithm _
) 
'Usage
 
Dim instance As Encryption
Dim directoryPath As System.String
Dim searchPattern As System.String
Dim searchOption As System.IO.SearchOption
Dim algorithm As SecureEraseAlgorithm
 
instance.SecureDirectoryErase(directoryPath, searchPattern, searchOption, algorithm)
public void SecureDirectoryErase( 
   System.string directoryPath,
   System.string searchPattern,
   System.IO.SearchOption searchOption,
   SecureEraseAlgorithm algorithm
)
public procedure SecureDirectoryErase( 
    directoryPath: System.String;
    searchPattern: System.String;
    searchOption: System.IO.SearchOption;
    algorithm: SecureEraseAlgorithm
); 
public function SecureDirectoryErase( 
   directoryPath : System.String,
   searchPattern : System.String,
   searchOption : System.IO.SearchOption,
   algorithm : SecureEraseAlgorithm
);
public: void SecureDirectoryErase( 
   System.string* directoryPath,
   System.string* searchPattern,
   System.IO.SearchOption searchOption,
   SecureEraseAlgorithm algorithm
) 
public:
void SecureDirectoryErase( 
   System.String^ directoryPath,
   System.String^ searchPattern,
   System.IO.SearchOption searchOption,
   SecureEraseAlgorithm algorithm
) 

Parameters

directoryPath
searchPattern
File wildcard pattern
searchOption
Recurse into sub directories
algorithm
The algorithm to use to overwrite files
Example
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);
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)
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

Encryption Class
Encryption Members
Overload List