NET SFTP Library
DeleteByWildcard(String,Boolean) Method
Example 






KellermanSoftware.NetSFtpLibrary Namespace > SFTP Class > DeleteByWildcard Method : DeleteByWildcard(String,Boolean) Method
Files to delete, in the format of *.ext
Whether or not to recurse sub directories
Deletes all of the files in the current directory matching a pattern
Syntax
'Declaration
 
Public Overloads Sub DeleteByWildcard( _
   ByVal pattern As System.String, _
   ByVal subDirectories As System.Boolean _
) 
'Usage
 
Dim instance As SFTP
Dim pattern As System.String
Dim subDirectories As System.Boolean
 
instance.DeleteByWildcard(pattern, subDirectories)
public void DeleteByWildcard( 
   System.string pattern,
   System.bool subDirectories
)
public procedure DeleteByWildcard( 
    pattern: System.String;
    subDirectories: System.Boolean
); 
public function DeleteByWildcard( 
   pattern : System.String,
   subDirectories : System.boolean
);
public: void DeleteByWildcard( 
   System.string* pattern,
   System.bool subDirectories
) 
public:
void DeleteByWildcard( 
   System.String^ pattern,
   System.bool subDirectories
) 

Parameters

pattern
Files to delete, in the format of *.ext
subDirectories
Whether or not to recurse sub directories
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
 
//Deletes all of the files in the current directory matching a pattern 
System.Console.WriteLine("We are trying to delete all files in the current directory and all subdirs");
 
sftp.DeleteByWildcard("*.txt", 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
 
'Deletes all of the files in the current directory matching a pattern
System.Console.WriteLine("We are trying to delete all files in the current directory and all subdirs")
 
sftp.DeleteByWildcard("*.txt", 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