NET SFTP Library
DeleteByWildcard(Regex,Boolean) Method
Example 






KellermanSoftware.NetSFtpLibrary Namespace > SFTP Class > DeleteByWildcard Method : DeleteByWildcard(Regex,Boolean) Method
Regex to match
Whether to recurse subdirectories
Deletes a file by a regular expression.
Syntax
'Declaration
 
Public Overloads Sub DeleteByWildcard( _
   ByVal pattern As System.Text.RegularExpressions.Regex, _
   ByVal subDirectories As System.Boolean _
) 
'Usage
 
Dim instance As SFTP
Dim pattern As System.Text.RegularExpressions.Regex
Dim subDirectories As System.Boolean
 
instance.DeleteByWildcard(pattern, subDirectories)
public void DeleteByWildcard( 
   System.Text.RegularExpressions.Regex pattern,
   System.bool subDirectories
)
public procedure DeleteByWildcard( 
    pattern: System.Text.RegularExpressions.Regex;
    subDirectories: System.Boolean
); 
public function DeleteByWildcard( 
   pattern : System.Text.RegularExpressions.Regex,
   subDirectories : System.boolean
);
public: void DeleteByWildcard( 
   System.Text.RegularExpressions.Regex* pattern,
   System.bool subDirectories
) 
public:
void DeleteByWildcard( 
   System.Text.RegularExpressions.Regex^ pattern,
   System.bool subDirectories
) 

Parameters

pattern
Regex to match
subDirectories
Whether to recurse subdirectories
Example
SFTP sftp = new SFTP(); //Trial Mode            
//SFTP sftp = new SFTP("place user name here", "place license key here");
 
// set the name of the SSH server( its URL )
sftp.HostAddress = "some.sftp.server.com"; // replace with your SFTP server
sftp.UserName  = "anonymous"; // replace with your user name
sftp.Password = "user@mail.com"; // replace with your password
 
//Delete files that start with the letter B
sftp.CurrentDirectory = "test";
sftp.DeleteByDateRange(new Regex("^B.+$"), true);
Dim sftp As SFTP = New SFTP() 'Trial Mode
'Dim sftp As SFTP = New SFTP("place user name here", "place license key here");
 
' set the name of the SSH server( its URL )
sftp.HostAddress = "some.sftp.server.com" ' replace with your SFTP server
sftp.UserName  = "anonymous" ' replace with your user name
sftp.Password = "user@mail.com" ' replace with your password
 
'Delete files that start with the letter B
sftp.CurrentDirectory = "test"
sftp.DeleteByDateRange(New Regex("^B.+$"), True)
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

SFTP Class
SFTP Members
Overload List