NET FTP Library
DeleteByWildcard(String,Boolean) Method
Example 






KellermanSoftware.NetFtpLibrary Namespace > FTP 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 FTP
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
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
 
//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");
 
ftp.DeleteByWildcard("*.txt", 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
 
'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")
 
ftp.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

FTP Class
FTP Members
Overload List