NET FTP Library
DeleteByWildcard(Regex,Boolean) Method
Example 






KellermanSoftware.NetFtpLibrary Namespace > FTP 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 FTP
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
FTP ftp = new FTP(); //Trial Mode            
//FTP ftp = new FTP("place user name here", "place license key here");
 
// set the name of the FTP server( its URL )
ftp.HostAddress = "ftp.fsz.bme.hu"; // a hungarian university. change this to your ftp server
ftp.UserName = "anonymous"; // replace with your user name
ftp.Password = "user@mail.com"; // replace with your password
 
//Delete files that start with the letter B
ftp.CurrentDirectory = "test";
ftp.DeleteByDateRange(new Regex("^B.+$"), true);
Dim ftp As FTP = New FTP() 'Trial Mode
'FTP ftp = new FTP("place user name here", "place license key here");
 
' set the name of the FTP server( its URL )
ftp.HostAddress = "ftp.fsz.bme.hu" ' a hungarian university. change this to your ftp server
ftp.UserName = "anonymous" ' replace with your user name
ftp.Password = "user@mail.com" ' replace with your password
 
'Delete files that start with the letter B
ftp.CurrentDirectory = "test"
ftp.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

FTP Class
FTP Members
Overload List